Skip to content

Commit

Permalink
log installation failures (#372)
Browse files Browse the repository at this point in the history
* log installation failures

* increase version

* fix

* fix log

* typo
  • Loading branch information
gunzip authored Nov 12, 2018
1 parent ac600e7 commit f517cdb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "italia-backend",
"version": "0.3.3",
"version": "0.3.4",
"description": "Italia app and web backend",
"main": "index.js",
"engines": {
Expand Down Expand Up @@ -137,4 +137,4 @@
"!src/**/*.d.ts"
]
}
}
}
5 changes: 4 additions & 1 deletion src/controllers/notificationController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ export default class NotificationController {
const errorOrUser = extractUserFromRequest(req);

if (isLeft(errorOrUser)) {
// Unable to extract the user from the request.
const error = errorOrUser.value;
log.error(
"Unable to extract the user from the request: %s",
error.message
);
return ResponseErrorInternal(error.message);
}

Expand Down
8 changes: 8 additions & 0 deletions src/services/notificationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
INotificationTemplate,
toFiscalCodeHash
} from "../types/notification";
import { log } from "../utils/logger";

/**
* A template suitable for Apple's APNs.
Expand Down Expand Up @@ -105,6 +106,13 @@ export default class NotificationService {
// tslint:disable-next-line:no-any
(azureInstallation as any) as string,
(error, response) => {
if (error) {
log.error(
"Unable to create installation: %s (error=%s)",
JSON.stringify(azureInstallation),
error.message
);
}
return resolve(this.buildResponse(error, response));
}
);
Expand Down

0 comments on commit f517cdb

Please sign in to comment.