Line data Source code
1 : import 'package:json_annotation/json_annotation.dart'; 2 : part 'error.g.dart'; 3 : 4 : /// If there is something wrong with the API request, 5 : /// Contentstack returns an error. 6 : /// Learn more about [Errors](https://www.contentstack.com/docs/developers/apis/content-delivery-api/#errors). 7 : @JsonSerializable(createFactory: true) 8 : class Error implements Exception { 9 : @JsonKey(name: 'error_message') 10 : final String errorMessage; 11 : @JsonKey(name: 'error_code') 12 : final int errorCode; 13 : final Map errors; 14 1 : Error({this.errorMessage, this.errorCode, this.errors}); 15 2 : factory Error.fromJson(Map<String, dynamic> json) => _$ErrorFromJson(json); 16 2 : Map<String, dynamic> toJson() => _$ErrorToJson(this); 17 : }