Line data Source code
1 : import 'package:json_annotation/json_annotation.dart'; 2 : part 'csexception.g.dart'; 3 : 4 : @JsonSerializable(createFactory: true) 5 : class CSException implements Exception { 6 : 7 : @JsonKey(name: "error_message") 8 : final String errorMessage; 9 : @JsonKey(name: "error_code") 10 : final int errorCode; 11 : int statusCode; 12 : 13 0 : CSException(this.errorMessage, this.errorCode); 14 : 15 0 : factory CSException.fromJson(Map<String, dynamic> json) => _$CSExceptionFromJson(json); 16 0 : Map<String, dynamic> toJson() => _$CSExceptionToJson(this); 17 : }