witness-org / witness

Your fitness witness!
1 stars 0 forks source link

61: Error-Key-Specific Error Messages in Client - [merged] #91

Closed raffaelfoidl closed 2 years ago

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 4, 2022, 18:19

Merges 61-error-key-specific-error-messages-in-client -> develop

Closes #61.


I don't know if it's the best way. But for testing, I simply threw some ServerException at the start of an endpoint method with a random ServerError argument and checked whether the correct localized error message pops up in the app when triggering the affected endpoint.

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 4, 2022, 18:20

Thank God (Lea) for RequesterState. Without it, the whole thing would have been much more cumbersome and many more changes would have been needed.

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 4, 2022, 18:22

requested review from @11712616

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 4, 2022, 18:24

Commented on client/lib/logging/log_message_preparer.dart line 3

The mixin keyword hasn't always been here. But now it exists, so we can use it :)

raffaelfoidl commented 2 years ago

In GitLab by @11712616 on Feb 5, 2022, 20:09

Commented on client/lib/localization/app_en.arb line 731

Regarding the naming: Wouldn't it be more consistent with the other localized strings' "names" to use camelCase here? I'm thinking of error_translation_certificateFetchFailed or even errorTranslation_certificateFetchFailed. This also applies to the other strings.

raffaelfoidl commented 2 years ago

In GitLab by @11712616 on Feb 5, 2022, 20:09

Commented on client/lib/localization/app_en.arb line 743

"for the provided email. This typically happens when"?

raffaelfoidl commented 2 years ago

In GitLab by @11712616 on Feb 5, 2022, 20:09

Commented on client/lib/localization/app_en.arb line 733

"error key" instead of "error-key" (or is there an explicit reason why you included the "-"?)? This also applies to all other strings.

raffaelfoidl commented 2 years ago

In GitLab by @11712616 on Feb 5, 2022, 20:09

Commented on client/lib/localization/app_en.arb line 779

All strings above have a "." at the end -> "match."

raffaelfoidl commented 2 years ago

In GitLab by @11712616 on Feb 5, 2022, 20:09

Commented on client/lib/localization/app_en.arb line 815

Maybe omit "for undefined reasons" as this does not help the user?

raffaelfoidl commented 2 years ago

In GitLab by @11712616 on Feb 5, 2022, 20:09

Commented on client/lib/localization/app_en.arb line 823

Remove "does"

raffaelfoidl commented 2 years ago

In GitLab by @11712616 on Feb 5, 2022, 20:09

Commented on client/lib/localization/app_en.arb line 839

This is a general remark that also applies to some other localized strings: When working on the client, shouldn't we strive for error messages that are as useful (i.e. helpful, not confusing) as possible to the actual user? I feel like error messages like this one make sense in the context of the server (logs), but could seem kind of strange for someone not involved in the development process that uses the app. For example, "the given user": For the person using the app, there is no other user than themselves, it is not necessary to include this information. I would suggest something like "There already exists a user exercise with this name." or even "You already have a user exercise with this name." What do you think?

I guess for some error strings, this is not really relevant because in the end, they will never be displayed in the client (for example, the WORKOUT_LOG_NOT_BY_USER string). Nevertheless, I think it would generally make sense to adjust the wording in the error messages such that they're more "directed" at the user.

raffaelfoidl commented 2 years ago

In GitLab by @11712616 on Feb 5, 2022, 20:09

Commented on client/lib/localization/app_en.arb line 843

See remark above - when using the app, I wouldn't be able to make sense of this message: What identifier? Am I the requesting user in this case?

raffaelfoidl commented 2 years ago

In GitLab by @11712616 on Feb 5, 2022, 20:09

Commented on client/lib/localization/app_en.arb line 875

"The logging type"?
"the given exercise"?

raffaelfoidl commented 2 years ago

In GitLab by @11712616 on Feb 5, 2022, 20:09

Commented on client/lib/localization/app_en.arb line 887

"An unexpected/unknown error occurred."?

raffaelfoidl commented 2 years ago

In GitLab by @11712616 on Feb 5, 2022, 20:09

Commented on client/lib/localization/app_en.arb line 891

"The provided email address is not valid."?

raffaelfoidl commented 2 years ago

In GitLab by @11712616 on Feb 5, 2022, 20:09

Commented on client/lib/localization/app_en.arb line 895

"The requested login method"

raffaelfoidl commented 2 years ago

In GitLab by @11712616 on Feb 5, 2022, 20:09

Commented on client/lib/models/workouts/workout_log_create.dart line 11

Thanks

raffaelfoidl commented 2 years ago

In GitLab by @11712616 on Feb 5, 2022, 20:09

Commented on client/lib/widgets/common/erorr_key_translator.dart line 59

I think we only need one heading for the example.

raffaelfoidl commented 2 years ago

In GitLab by @11712616 on Feb 5, 2022, 20:09

Commented on client/lib/widgets/common/erorr_key_translator.dart line 1

Please change the filename to error_key_translator.dart :]

raffaelfoidl commented 2 years ago

In GitLab by @11712616 on Feb 5, 2022, 20:09

Commented on server/src/main/java/com/witness/server/exception/AccessDeniedException.java line 13

Super!

raffaelfoidl commented 2 years ago

In GitLab by @11712616 on Feb 5, 2022, 20:09

Commented on server/src/main/java/com/witness/server/validation/EmailStrict.java line 19

"illegal characters. Therefore," (I'm having flashbacks to proof-reading Timo's bachelor thesis)

raffaelfoidl commented 2 years ago

In GitLab by @11712616 on Feb 5, 2022, 20:10

I was actually super proud of my RequesterState. Thanks for appreciating it.

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:39

Commented on client/lib/localization/app_en.arb line 731

changed this line in version 2 of the diff

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:39

Commented on client/lib/localization/app_en.arb line 743

changed this line in version 2 of the diff

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:39

Commented on client/lib/localization/app_en.arb line 733

changed this line in version 2 of the diff

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:39

Commented on client/lib/localization/app_en.arb line 779

changed this line in version 2 of the diff

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:39

Commented on client/lib/localization/app_en.arb line 815

changed this line in version 2 of the diff

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:39

Commented on client/lib/localization/app_en.arb line 823

changed this line in version 2 of the diff

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:39

Commented on client/lib/localization/app_en.arb line 839

changed this line in version 2 of the diff

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:39

Commented on client/lib/localization/app_en.arb line 843

changed this line in version 2 of the diff

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:39

Commented on client/lib/localization/app_en.arb line 875

changed this line in version 2 of the diff

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:39

Commented on client/lib/localization/app_en.arb line 887

changed this line in version 2 of the diff

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:39

Commented on client/lib/localization/app_en.arb line 891

changed this line in version 2 of the diff

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:39

Commented on client/lib/localization/app_en.arb line 895

changed this line in version 2 of the diff

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:39

Commented on client/lib/widgets/common/erorr_key_translator.dart line 59

changed this line in version 2 of the diff

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:39

Commented on client/lib/widgets/common/erorr_key_translator.dart line 1

changed this line in version 2 of the diff

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:39

Commented on server/src/main/java/com/witness/server/validation/EmailStrict.java line 19

changed this line in version 2 of the diff

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:39

added 18 commits

Compare with previous version

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:50

Commented on client/lib/localization/app_en.arb line 731

Yes, you are right. The main goal I had in mind for this ticket was to bring the infrastructure for this error key translation functionality to the client, in some way. So of course it can be improved later on, I just wanted to support a basic version of this.

Since there are quite some error keys, I created the entries in the arb file automatically. I copied and pasted the enum members from the server and replaced them with a nifty regex. The pattern took the documentation and set it as message, the description is always the same and, lastly, the key of the localized error message was created by appending the lowercased enum member (see Regex Replace Case Conversion - really cool, but not supported by many Regex engines...of course, IntelliJ does :heart:). That's the reason why the keys are not camel-cased like normally. And I didn't think of fixing it after implementing the thing.

-> cbddcccfcbde6a38cbc810a616b0c4b1bf48c07c

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:50

Commented on client/lib/localization/app_en.arb line 733

:shrug:

-> 1e066512be3d428d9924d824b0f6c10f7b90ce39

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:50

Commented on client/lib/localization/app_en.arb line 779

-> 4f392be6c7ba404a0f04265df55620849236e496

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:50

Commented on client/lib/localization/app_en.arb line 815

-> 358bb0ab25f7444391b5cf4ca2ce5dfcda4c7320

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:50

Commented on client/lib/localization/app_en.arb line 823

-> e0efd0d42f6b47a487696e57257a0082f9a67da4

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:50

Commented on client/lib/widgets/common/erorr_key_translator.dart line 1

Hm, that explains why I could never jump to this file with CTRL+SHIFT+N.

-> af6af9432dd79853a77df864a6d0e0973b2832fb

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:50

Commented on server/src/main/java/com/witness/server/validation/EmailStrict.java line 19

In my defence, I was basically asleep when I wrote this. Just wanted to get done with it, open up the MR - and then I was a bit fed up with having to amend the documentation.

-> aa88dd7b7705ad91e9b97ae44db0126cb914ad29

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:50

Commented on client/lib/localization/app_en.arb line 743

-> 227c2c667866cd0108719bbd918780a57a8c21ed

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:50

Commented on client/lib/widgets/common/erorr_key_translator.dart line 59

stingy as ever

-> 40f6108f35f518392411d0b38048001f582156be

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:50

Commented on client/lib/localization/app_en.arb line 895

-> 042ae744c99cab5f43ceb07d9288506f1ad7f619

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:50

Commented on client/lib/localization/app_en.arb line 891

-> dd278374f7d436b17c1c5c8c2309056db888ee8e

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:50

Commented on client/lib/localization/app_en.arb line 887

-> d71f615d44334e8153d43ab00044af64b89f77b5

raffaelfoidl commented 2 years ago

In GitLab by @11775820 on Feb 6, 2022, 11:50

Commented on client/lib/localization/app_en.arb line 875

-> 89fb800e05eb86d4201adc59e4a22d83f12454e6