File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
lib/utils/riverpod/riverpod_providers/generated_providers Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -1149,18 +1149,21 @@ class TokenNotifier extends _$TokenNotifier with ResultHandler {
11491149 // If no specific status message was set, try to extract the error message from the response body
11501150 // or fallback to a generic error message and the status code as details.
11511151 if (statusMessage == null ) {
1152+ String ? message;
11521153 try {
1153- final String message = response.body.isNotEmpty
1154+ message = response.body.isNotEmpty
11541155 ? (json.decode (response.body)['result' ]? ['error' ]? ['message' ] ?? '' )
11551156 : '' ;
1157+ } on FormatException {
1158+ // Format Exception is thrown if the response body is not a valid json. This happens if the server is not reachable.
1159+ }
1160+ if (message == null || message.isEmpty) {
11561161 statusMessage = StatusMessage (
11571162 message: (localization) =>
11581163 localization.errorRollOutFailed (tokenLabel),
11591164 details: (_) => message.toString (),
11601165 );
1161- } on FormatException {
1162- // Format Exception is thrown if the response body is not a valid json. This happens if the server is not reachable.
1163-
1166+ } else {
11641167 statusMessage = StatusMessage (
11651168 message: (localization) =>
11661169 localization.errorRollOutFailed (tokenLabel),
You can’t perform that action at this time.
0 commit comments