RequestError.fromJson constructor
RequestError.fromJson(})
Implementation
factory RequestError.fromJson(
JsonDecoder jsonDecoder,
String jsonPath,
Object? json, {
ClientUriConverter? clientUriConverter,
}) {
json ??= {};
if (json is Map) {
RequestErrorCode code;
if (json.containsKey('code')) {
code = RequestErrorCode.fromJson(
jsonDecoder,
'$jsonPath.code',
json['code'],
clientUriConverter: clientUriConverter,
);
} else {
throw jsonDecoder.mismatch(jsonPath, 'code');
}
String message;
if (json.containsKey('message')) {
message = jsonDecoder.decodeString(
'$jsonPath.message',
json['message'],
);
} else {
throw jsonDecoder.mismatch(jsonPath, 'message');
}
String? stackTrace;
if (json.containsKey('stackTrace')) {
stackTrace = jsonDecoder.decodeString(
'$jsonPath.stackTrace',
json['stackTrace'],
);
}
return RequestError(code, message, stackTrace: stackTrace);
} else {
throw jsonDecoder.mismatch(jsonPath, 'RequestError', json);
}
}