immich
immich copied to clipboard
refactor(mobile): move error details to separate DB column
As discussed in #6866, logRecord.error previously wasn't stored in the DB. Instead, a string copy of it was merged into the message in most places. Separate the two, so the log overview shows a brief description of the error while the details (usually an exception, but could be any string) can be found in the details page.
I adjusted many places to split the log message into its headline and the details, but for sure there will be some that I've missed. It shouldn't be a problem to adjust those later. There might also be places where adding further details as string could be helpful, like a few statistics when the upload has finished.
@shenlong-tanwen: PTAL
That's funny... first it complains that
final failedResponse =
imageResponse.statusCode != 200 ? imageResponse : motionReponse;
_log.severe("Motion asset download failed", failedResponse.toLoggerString());
return false;
is bad and formats it to
final failedResponse =
imageResponse.statusCode != 200 ? imageResponse : motionReponse;
_log.severe(
"Motion asset download failed", failedResponse.toLoggerString());
return false;
(which is less readable from my point of view). But somehow the linter isn't friends with the formatter and wants to have a final comma:
final failedResponse =
imageResponse.statusCode != 200 ? imageResponse : motionReponse;
_log.severe(
"Motion asset download failed", failedResponse.toLoggerString(),);
return false;
The end? No, the formatter wants some changes again:
final failedResponse =
imageResponse.statusCode != 200 ? imageResponse : motionReponse;
_log.severe(
"Motion asset download failed",
failedResponse.toLoggerString(),
);
return false;
Looks better at least, but it pushed a simply log message from one to four lines and made it seem more important than it needs to be. Similar for the line above that. I thought the formatter is supposed to improve readability but, the 80 character limit achieves the opposite in my eyes (literally :grin:).
OK. Rant over, Dart seems to be happy now, so hopefully ready to merge. 😉