dumpError method

FutureOr<Response> dumpError(
  1. List<EntityModel> entities,
  2. DataOperation operation
)

Implementation

FutureOr<Response> dumpError(
  List<EntityModel> entities,
  DataOperation operation,
) async {
  return executeFuture(
    future: () async {
      String url = "";

      if (operation == DataOperation.create) {
        url = bulkCreatePath;
      } else if (operation == DataOperation.update) {
        url = bulkUpdatePath;
      } else if (operation == DataOperation.delete) {
        url = bulkDeletePath;
      } else if (operation == DataOperation.singleCreate) {
        url = createPath;
      } else if (operation == DataOperation.singleCreate) {
        url = searchPath;
      }

      return await dio.post(
        'error-handler/handle-error', // [TODO: Update this URL]
        options: Options(headers: {
          "content-type": 'application/json',
        }),
        data: {
          'errorDetail': {
            "apiDetails": {
              "id": null,
              "url": url,
              "contentType": null,
              "methodType": null,
              "requestBody": _getMap(entities).toString(),
              "requestHeaders": null,
              "additionalDetails": null,
            },
            "errors": [
              {
                "exception": null,
                "type": "NON_RECOVERABLE",
                "errorCode": null,
                "errorMessage": "UPLOAD_ERROR_FROM_APP",
                "additionalDetails": null,
              },
            ],
          },
        },
      );
    },
  );
}