chore: show error message in upload details route (#22472)

* chore: show error message in upload details route

* pretty format exception

---------

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong 2025-09-29 23:01:09 +05:30 committed by GitHub
parent ee3c07d049
commit 75b9bd163e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 48 additions and 8 deletions

View file

@ -1,3 +1,5 @@
import 'dart:convert';
extension StringExtension on String {
String capitalize() {
return split(" ").map((str) => str.isEmpty ? str : str[0].toUpperCase() + str.substring(1)).join(" ");
@ -23,3 +25,11 @@ extension DurationExtension on String {
return int.parse(this);
}
}
Map<String, dynamic>? tryJsonDecode(dynamic json) {
try {
return jsonDecode(json) as Map<String, dynamic>;
} catch (e) {
return null;
}
}