The Inbox: System-ct.1161.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: System-ct.1161.mcz

commits-2
Christoph Thiede uploaded a new version of System to project The Inbox:
http://source.squeak.org/inbox/System-ct.1161.mcz

==================== Summary ====================

Name: System-ct.1161
Author: ct
Time: 6 June 2020, 8:19:13.480392 pm
UUID: 173a90f3-4bb8-fc46-b5a6-6e4ab74e63ca
Ancestors: System-mt.1160

Catch all InvalidDirectoryErrors in GetTextTranslator availableLanguageLocaleIDs. Those exceptions are an implementation detail and may not confuse the caller. Such a confusion happened in connection with Morphic-ct.1638.

=============== Diff against System-mt.1160 ===============

Item was changed:
  ----- Method: GetTextTranslator class>>availableLanguageLocaleIDs (in category 'accessing') -----
  availableLanguageLocaleIDs
  "GetTextTranslator availableLanguageLocaleIDs"
  | ids dirs localeDirForLang directoryNames |
  ids := Set new.
  dirs := Set new.
  dirs addAll: LocaleDirsForDomain values.
  dirs addAll: self defaultLocaleDirs.
+ [dirs do: [:dir |
- dirs do: [:dir |
  | localesDir |
  localesDir := FileDirectory on: dir.
+ directoryNames := localesDir directoryNames.
- directoryNames := [localesDir directoryNames] on: InvalidDirectoryError do: [:e | #()].
  directoryNames
  do: [:langDirName |
  | localeID  |
  localeID := LocaleID posixName: langDirName.
  localeDirForLang := localesDir directoryNamed: (self langDirNameForLocaleID: localeID).
  localeDirForLang ifNotNil: [
  (localeDirForLang fileNamesMatching: '*.mo') ifNotEmpty: [ids add: localeID]].
  localeID hasParent ifTrue: [
  localeDirForLang := localesDir directoryNamed: (self langDirNameForLocaleID: localeID parent).
  localeDirForLang ifNotNil: [
  (localeDirForLang fileNamesMatching: '*.mo') ifNotEmpty: [ids add: localeID parent]]].
  ].
+ ]] on: InvalidDirectoryError do: [:error | error resumeUnchecked: error defaultAction].
- ].
  ^ids!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: System-ct.1161.mcz

Christoph Thiede

I wonder anyway why InvalidDirectoryError & Co. override #defaultAction ...

If they are serious errors, they should show up a debugger via UndefinedError but not silently fix that anyhow by returning a default value, shouldn't they?

And if they are no serious errors, they should be Notifications IMO.


What do you think? :-)


Best,

Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von [hidden email] <[hidden email]>
Gesendet: Samstag, 6. Juni 2020 20:19:27
An: [hidden email]
Betreff: [squeak-dev] The Inbox: System-ct.1161.mcz
 
Christoph Thiede uploaded a new version of System to project The Inbox:
http://source.squeak.org/inbox/System-ct.1161.mcz

==================== Summary ====================

Name: System-ct.1161
Author: ct
Time: 6 June 2020, 8:19:13.480392 pm
UUID: 173a90f3-4bb8-fc46-b5a6-6e4ab74e63ca
Ancestors: System-mt.1160

Catch all InvalidDirectoryErrors in GetTextTranslator availableLanguageLocaleIDs. Those exceptions are an implementation detail and may not confuse the caller. Such a confusion happened in connection with Morphic-ct.1638.

=============== Diff against System-mt.1160 ===============

Item was changed:
  ----- Method: GetTextTranslator class>>availableLanguageLocaleIDs (in category 'accessing') -----
  availableLanguageLocaleIDs
         "GetTextTranslator availableLanguageLocaleIDs"
         | ids dirs localeDirForLang directoryNames |
         ids := Set new.
         dirs := Set new.
         dirs addAll: LocaleDirsForDomain values.
         dirs addAll: self defaultLocaleDirs.
+        [dirs do: [:dir |
-        dirs do: [:dir |
                 | localesDir |
                 localesDir := FileDirectory on: dir.
+                directoryNames := localesDir directoryNames.
-                directoryNames := [localesDir directoryNames] on: InvalidDirectoryError do: [:e | #()].
                 directoryNames
                                 do: [:langDirName |
                                         | localeID  |
                                         localeID := LocaleID posixName: langDirName.
                                         localeDirForLang := localesDir directoryNamed: (self langDirNameForLocaleID: localeID).
                                         localeDirForLang ifNotNil: [
                                                 (localeDirForLang fileNamesMatching: '*.mo') ifNotEmpty: [ids add: localeID]].
                                         localeID hasParent ifTrue: [
                                                 localeDirForLang := localesDir directoryNamed: (self langDirNameForLocaleID: localeID parent).
                                                 localeDirForLang ifNotNil: [
                                                         (localeDirForLang fileNamesMatching: '*.mo') ifNotEmpty: [ids add: localeID parent]]].
                                 ].
+        ]] on: InvalidDirectoryError do: [:error | error resumeUnchecked: error defaultAction].
-        ].
         ^ids!




Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: System-ct.1161.mcz

Jakob Reschke
Errors are not resumable, although these errors with defaultActions
will resume with something if they do not signal another exception and
*if they are not handled*. If you turned this into a Notification, you
could resume it with another directory listing, but how much sense
would that make?

Am Sa., 6. Juni 2020 um 20:22 Uhr schrieb Thiede, Christoph
<[hidden email]>:

>
> I wonder anyway why InvalidDirectoryError & Co. override #defaultAction ...
>
> If they are serious errors, they should show up a debugger via UndefinedError but not silently fix that anyhow by returning a default value, shouldn't they?
>
> And if they are no serious errors, they should be Notifications IMO.
>
>
> What do you think? :-)
>
>
> Best,
>
> Christoph
>
> ________________________________
> Von: Squeak-dev <[hidden email]> im Auftrag von [hidden email] <[hidden email]>
> Gesendet: Samstag, 6. Juni 2020 20:19:27
> An: [hidden email]
> Betreff: [squeak-dev] The Inbox: System-ct.1161.mcz
>
> Christoph Thiede uploaded a new version of System to project The Inbox:
> http://source.squeak.org/inbox/System-ct.1161.mcz
>
> ==================== Summary ====================
>
> Name: System-ct.1161
> Author: ct
> Time: 6 June 2020, 8:19:13.480392 pm
> UUID: 173a90f3-4bb8-fc46-b5a6-6e4ab74e63ca
> Ancestors: System-mt.1160
>
> Catch all InvalidDirectoryErrors in GetTextTranslator availableLanguageLocaleIDs. Those exceptions are an implementation detail and may not confuse the caller. Such a confusion happened in connection with Morphic-ct.1638.
>
> =============== Diff against System-mt.1160 ===============
>
> Item was changed:
>   ----- Method: GetTextTranslator class>>availableLanguageLocaleIDs (in category 'accessing') -----
>   availableLanguageLocaleIDs
>          "GetTextTranslator availableLanguageLocaleIDs"
>          | ids dirs localeDirForLang directoryNames |
>          ids := Set new.
>          dirs := Set new.
>          dirs addAll: LocaleDirsForDomain values.
>          dirs addAll: self defaultLocaleDirs.
> +        [dirs do: [:dir |
> -        dirs do: [:dir |
>                  | localesDir |
>                  localesDir := FileDirectory on: dir.
> +                directoryNames := localesDir directoryNames.
> -                directoryNames := [localesDir directoryNames] on: InvalidDirectoryError do: [:e | #()].
>                  directoryNames
>                                  do: [:langDirName |
>                                          | localeID  |
>                                          localeID := LocaleID posixName: langDirName.
>                                          localeDirForLang := localesDir directoryNamed: (self langDirNameForLocaleID: localeID).
>                                          localeDirForLang ifNotNil: [
>                                                  (localeDirForLang fileNamesMatching: '*.mo') ifNotEmpty: [ids add: localeID]].
>                                          localeID hasParent ifTrue: [
>                                                  localeDirForLang := localesDir directoryNamed: (self langDirNameForLocaleID: localeID parent).
>                                                  localeDirForLang ifNotNil: [
>                                                          (localeDirForLang fileNamesMatching: '*.mo') ifNotEmpty: [ids add: localeID parent]]].
>                                  ].
> +        ]] on: InvalidDirectoryError do: [:error | error resumeUnchecked: error defaultAction].
> -        ].
>          ^ids!
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: System-ct.1161.mcz

marcel.taeumel
Hi Christoph,

look at the senders of #resumeUnchecked:. ;-) This message is rather inappropriate to be used in GetTextTranslator. 

If you want to fix image startup, then I suggest to put such exception handlers in NaturalLanguageTranslator class >> #startUp:.

But maybe we can find an even better way to collect errors during image startup and present them only after at least the GUI system was initialized, which happens through Project class >> #startUp: at the moment. Also take a look at ToolSet class >> #debugException:.

Best,
Marcel

Am 06.06.2020 20:55:04 schrieb Jakob Reschke <[hidden email]>:

Errors are not resumable, although these errors with defaultActions
will resume with something if they do not signal another exception and
*if they are not handled*. If you turned this into a Notification, you
could resume it with another directory listing, but how much sense
would that make?

Am Sa., 6. Juni 2020 um 20:22 Uhr schrieb Thiede, Christoph
:

>
> I wonder anyway why InvalidDirectoryError & Co. override #defaultAction ...
>
> If they are serious errors, they should show up a debugger via UndefinedError but not silently fix that anyhow by returning a default value, shouldn't they?
>
> And if they are no serious errors, they should be Notifications IMO.
>
>
> What do you think? :-)
>
>
> Best,
>
> Christoph
>
> ________________________________
> Von: Squeak-dev im Auftrag von [hidden email]
> Gesendet: Samstag, 6. Juni 2020 20:19:27
> An: [hidden email]
> Betreff: [squeak-dev] The Inbox: System-ct.1161.mcz
>
> Christoph Thiede uploaded a new version of System to project The Inbox:
> http://source.squeak.org/inbox/System-ct.1161.mcz
>
> ==================== Summary ====================
>
> Name: System-ct.1161
> Author: ct
> Time: 6 June 2020, 8:19:13.480392 pm
> UUID: 173a90f3-4bb8-fc46-b5a6-6e4ab74e63ca
> Ancestors: System-mt.1160
>
> Catch all InvalidDirectoryErrors in GetTextTranslator availableLanguageLocaleIDs. Those exceptions are an implementation detail and may not confuse the caller. Such a confusion happened in connection with Morphic-ct.1638.
>
> =============== Diff against System-mt.1160 ===============
>
> Item was changed:
> ----- Method: GetTextTranslator class>>availableLanguageLocaleIDs (in category 'accessing') -----
> availableLanguageLocaleIDs
> "GetTextTranslator availableLanguageLocaleIDs"
> | ids dirs localeDirForLang directoryNames |
> ids := Set new.
> dirs := Set new.
> dirs addAll: LocaleDirsForDomain values.
> dirs addAll: self defaultLocaleDirs.
> + [dirs do: [:dir |
> - dirs do: [:dir |
> | localesDir |
> localesDir := FileDirectory on: dir.
> + directoryNames := localesDir directoryNames.
> - directoryNames := [localesDir directoryNames] on: InvalidDirectoryError do: [:e | #()].
> directoryNames
> do: [:langDirName |
> | localeID |
> localeID := LocaleID posixName: langDirName.
> localeDirForLang := localesDir directoryNamed: (self langDirNameForLocaleID: localeID).
> localeDirForLang ifNotNil: [
> (localeDirForLang fileNamesMatching: '*.mo') ifNotEmpty: [ids add: localeID]].
> localeID hasParent ifTrue: [
> localeDirForLang := localesDir directoryNamed: (self langDirNameForLocaleID: localeID parent).
> localeDirForLang ifNotNil: [
> (localeDirForLang fileNamesMatching: '*.mo') ifNotEmpty: [ids add: localeID parent]]].
> ].
> + ]] on: InvalidDirectoryError do: [:error | error resumeUnchecked: error defaultAction].
> - ].
> ^ids!
>
>
>



Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: System-ct.1161.mcz

Christoph Thiede

Hi Marcel,


should GetTextTranslator expose these errors anyway?

At the moment, [GetTextTranslator availableLanguageLocaleIDs] ifError: [self error] would regularly fail.

What about "error return: error defaultAction"? I know this is not identical, but it should have an equivalent effect in this situation.


But maybe we can find an even better way to collect errors during image startup and present them only after at least the GUI system was initialized, which happens through Project class >> #startUp: at the moment. Also take a look at ToolSet class >> #debugException:.


Interesting idea! :-)

Best,
Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 8. Juni 2020 08:40:26
An: squeak-dev
Betreff: Re: [squeak-dev] The Inbox: System-ct.1161.mcz
 
Hi Christoph,

look at the senders of #resumeUnchecked:. ;-) This message is rather inappropriate to be used in GetTextTranslator. 

If you want to fix image startup, then I suggest to put such exception handlers in NaturalLanguageTranslator class >> #startUp:.

But maybe we can find an even better way to collect errors during image startup and present them only after at least the GUI system was initialized, which happens through Project class >> #startUp: at the moment. Also take a look at ToolSet class >> #debugException:.

Best,
Marcel

Am 06.06.2020 20:55:04 schrieb Jakob Reschke <[hidden email]>:

Errors are not resumable, although these errors with defaultActions
will resume with something if they do not signal another exception and
*if they are not handled*. If you turned this into a Notification, you
could resume it with another directory listing, but how much sense
would that make?

Am Sa., 6. Juni 2020 um 20:22 Uhr schrieb Thiede, Christoph
:
>
> I wonder anyway why InvalidDirectoryError & Co. override #defaultAction ...
>
> If they are serious errors, they should show up a debugger via UndefinedError but not silently fix that anyhow by returning a default value, shouldn't they?
>
> And if they are no serious errors, they should be Notifications IMO.
>
>
> What do you think? :-)
>
>
> Best,
>
> Christoph
>
> ________________________________
> Von: Squeak-dev im Auftrag von [hidden email]
> Gesendet: Samstag, 6. Juni 2020 20:19:27
> An: [hidden email]
> Betreff: [squeak-dev] The Inbox: System-ct.1161.mcz
>
> Christoph Thiede uploaded a new version of System to project The Inbox:
> http://source.squeak.org/inbox/System-ct.1161.mcz
>
> ==================== Summary ====================
>
> Name: System-ct.1161
> Author: ct
> Time: 6 June 2020, 8:19:13.480392 pm
> UUID: 173a90f3-4bb8-fc46-b5a6-6e4ab74e63ca
> Ancestors: System-mt.1160
>
> Catch all InvalidDirectoryErrors in GetTextTranslator availableLanguageLocaleIDs. Those exceptions are an implementation detail and may not confuse the caller. Such a confusion happened in connection with Morphic-ct.1638.
>
> =============== Diff against System-mt.1160 ===============
>
> Item was changed:
> ----- Method: GetTextTranslator class>>availableLanguageLocaleIDs (in category 'accessing') -----
> availableLanguageLocaleIDs
> "GetTextTranslator availableLanguageLocaleIDs"
> | ids dirs localeDirForLang directoryNames |
> ids := Set new.
> dirs := Set new.
> dirs addAll: LocaleDirsForDomain values.
> dirs addAll: self defaultLocaleDirs.
> + [dirs do: [:dir |
> - dirs do: [:dir |
> | localesDir |
> localesDir := FileDirectory on: dir.
> + directoryNames := localesDir directoryNames.
> - directoryNames := [localesDir directoryNames] on: InvalidDirectoryError do: [:e | #()].
> directoryNames
> do: [:langDirName |
> | localeID |
> localeID := LocaleID posixName: langDirName.
> localeDirForLang := localesDir directoryNamed: (self langDirNameForLocaleID: localeID).
> localeDirForLang ifNotNil: [
> (localeDirForLang fileNamesMatching: '*.mo') ifNotEmpty: [ids add: localeID]].
> localeID hasParent ifTrue: [
> localeDirForLang := localesDir directoryNamed: (self langDirNameForLocaleID: localeID parent).
> localeDirForLang ifNotNil: [
> (localeDirForLang fileNamesMatching: '*.mo') ifNotEmpty: [ids add: localeID parent]]].
> ].
> + ]] on: InvalidDirectoryError do: [:error | error resumeUnchecked: error defaultAction].
> - ].
> ^ids!
>
>
>



Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: System-ct.1161.mcz

Christoph Thiede

Hi Marcel,


this issue is still up to date and I would like to make the discussed method more robust. Will you accept a patch that uses "error return: error defaultAction" to handle any errors occurring during the operation? :-)


Best,

Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von Thiede, Christoph
Gesendet: Montag, 8. Juni 2020 09:48:20
An: squeak-dev
Betreff: Re: [squeak-dev] The Inbox: System-ct.1161.mcz
 

Hi Marcel,


should GetTextTranslator expose these errors anyway?

At the moment, [GetTextTranslator availableLanguageLocaleIDs] ifError: [self error] would regularly fail.

What about "error return: error defaultAction"? I know this is not identical, but it should have an equivalent effect in this situation.


But maybe we can find an even better way to collect errors during image startup and present them only after at least the GUI system was initialized, which happens through Project class >> #startUp: at the moment. Also take a look at ToolSet class >> #debugException:.


Interesting idea! :-)

Best,
Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 8. Juni 2020 08:40:26
An: squeak-dev
Betreff: Re: [squeak-dev] The Inbox: System-ct.1161.mcz
 
Hi Christoph,

look at the senders of #resumeUnchecked:. ;-) This message is rather inappropriate to be used in GetTextTranslator. 

If you want to fix image startup, then I suggest to put such exception handlers in NaturalLanguageTranslator class >> #startUp:.

But maybe we can find an even better way to collect errors during image startup and present them only after at least the GUI system was initialized, which happens through Project class >> #startUp: at the moment. Also take a look at ToolSet class >> #debugException:.

Best,
Marcel

Am 06.06.2020 20:55:04 schrieb Jakob Reschke <[hidden email]>:

Errors are not resumable, although these errors with defaultActions
will resume with something if they do not signal another exception and
*if they are not handled*. If you turned this into a Notification, you
could resume it with another directory listing, but how much sense
would that make?

Am Sa., 6. Juni 2020 um 20:22 Uhr schrieb Thiede, Christoph
:
>
> I wonder anyway why InvalidDirectoryError & Co. override #defaultAction ...
>
> If they are serious errors, they should show up a debugger via UndefinedError but not silently fix that anyhow by returning a default value, shouldn't they?
>
> And if they are no serious errors, they should be Notifications IMO.
>
>
> What do you think? :-)
>
>
> Best,
>
> Christoph
>
> ________________________________
> Von: Squeak-dev im Auftrag von [hidden email]
> Gesendet: Samstag, 6. Juni 2020 20:19:27
> An: [hidden email]
> Betreff: [squeak-dev] The Inbox: System-ct.1161.mcz
>
> Christoph Thiede uploaded a new version of System to project The Inbox:
> http://source.squeak.org/inbox/System-ct.1161.mcz
>
> ==================== Summary ====================
>
> Name: System-ct.1161
> Author: ct
> Time: 6 June 2020, 8:19:13.480392 pm
> UUID: 173a90f3-4bb8-fc46-b5a6-6e4ab74e63ca
> Ancestors: System-mt.1160
>
> Catch all InvalidDirectoryErrors in GetTextTranslator availableLanguageLocaleIDs. Those exceptions are an implementation detail and may not confuse the caller. Such a confusion happened in connection with Morphic-ct.1638.
>
> =============== Diff against System-mt.1160 ===============
>
> Item was changed:
> ----- Method: GetTextTranslator class>>availableLanguageLocaleIDs (in category 'accessing') -----
> availableLanguageLocaleIDs
> "GetTextTranslator availableLanguageLocaleIDs"
> | ids dirs localeDirForLang directoryNames |
> ids := Set new.
> dirs := Set new.
> dirs addAll: LocaleDirsForDomain values.
> dirs addAll: self defaultLocaleDirs.
> + [dirs do: [:dir |
> - dirs do: [:dir |
> | localesDir |
> localesDir := FileDirectory on: dir.
> + directoryNames := localesDir directoryNames.
> - directoryNames := [localesDir directoryNames] on: InvalidDirectoryError do: [:e | #()].
> directoryNames
> do: [:langDirName |
> | localeID |
> localeID := LocaleID posixName: langDirName.
> localeDirForLang := localesDir directoryNamed: (self langDirNameForLocaleID: localeID).
> localeDirForLang ifNotNil: [
> (localeDirForLang fileNamesMatching: '*.mo') ifNotEmpty: [ids add: localeID]].
> localeID hasParent ifTrue: [
> localeDirForLang := localesDir directoryNamed: (self langDirNameForLocaleID: localeID parent).
> localeDirForLang ifNotNil: [
> (localeDirForLang fileNamesMatching: '*.mo') ifNotEmpty: [ids add: localeID parent]]].
> ].
> + ]] on: InvalidDirectoryError do: [:error | error resumeUnchecked: error defaultAction].
> - ].
> ^ids!
>
>
>



Carpe Squeak!