Handle new error code for consumption retrieval
MODIFY
src/server/rest/v1/service/AssetService.ts
src/server/rest/v1/service/AssetService.ts
@@ -223,7 +223,12 @@ export default class AssetService {
await AssetStorage.saveAsset(req.tenant, asset);
}
} else {
- // TODO: Return a specific HTTP code to tell the user that the consumption cannot be retrieved
+ throw new AppError({
+ errorCode: HTTPError.CANNOT_RETRIEVE_CONSUMPTION,
+ message: 'Consumption cannot be retrieved',
+ user: req.user,
+ module: MODULE_NAME, method: 'handleRetrieveConsumption'
+ });
}
res.json(Constants.REST_RESPONSE_SUCCESS);
next();

MODIFY
src/types/HTTPError.ts
src/types/HTTPError.ts
@@ -75,6 +75,8 @@ export enum HTTPError {
OCPI_ENDPOINT_ALREADY_REGISTERED = 530,
OCPI_ENDPOINT_ALREADY_UNREGISTERED = 531,
+
+ CANNOT_RETRIEVE_CONSUMPTION = 533,
}
export enum HTTPAuthError {

Handle new error code for consumption retrieval