@yrpri/api 9.0.127 → 9.0.128

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/app.js +26 -15
  2. package/package.json +2 -2
package/app.js CHANGED
@@ -904,21 +904,20 @@ export class YourPrioritiesApi {
904
904
  err: bodyError,
905
905
  });
906
906
  }
907
- log.error("General Error", {
908
- context: "generalError",
909
- user: req.user ? toJson(req.user) : null,
910
- err: err,
911
- protocol: req.protocol,
912
- host: req.get("host"),
913
- originalUrl: req.originalUrl,
914
- body,
915
- errStack: err.stack,
916
- errorStatus: status,
917
- });
918
- err.url = req.url;
919
- err.params = req.params;
920
- if (status !== 404 && status !== 401) {
921
- // Optionally notify an error tracking service like Airbrake
907
+ if (status >= 500) {
908
+ log.error("General Error", {
909
+ context: "generalError",
910
+ user: req.user ? toJson(req.user) : null,
911
+ err: err,
912
+ protocol: req.protocol,
913
+ host: req.get("host"),
914
+ originalUrl: req.originalUrl,
915
+ body,
916
+ errStack: err.stack,
917
+ errorStatus: status,
918
+ });
919
+ err.url = req.url;
920
+ err.params = req.params;
922
921
  if (airbrake) {
923
922
  airbrake.notify(err).then((airbrakeErr) => {
924
923
  if (airbrakeErr.error) {
@@ -932,6 +931,18 @@ export class YourPrioritiesApi {
932
931
  });
933
932
  }
934
933
  }
934
+ else {
935
+ log.warn("Client Error", {
936
+ context: "clientError",
937
+ user: req.user ? toJson(req.user) : null,
938
+ err: err.message || err,
939
+ protocol: req.protocol,
940
+ host: req.get("host"),
941
+ originalUrl: req.originalUrl,
942
+ body,
943
+ errorStatus: status,
944
+ });
945
+ }
935
946
  res.sendStatus(status);
936
947
  });
937
948
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yrpri/api",
3
- "version": "9.0.127",
3
+ "version": "9.0.128",
4
4
  "license": "MIT",
5
5
  "author": "Robert Bjarnason & Citizens Foundation",
6
6
  "repository": {
@@ -25,7 +25,7 @@
25
25
  "@google-cloud/vertexai": "^1.10.0",
26
26
  "@google-cloud/vision": "^5.1.0",
27
27
  "@node-saml/passport-saml": "^5.0.1",
28
- "@policysynth/agents": "^1.3.104",
28
+ "@policysynth/agents": "^1.3.105",
29
29
  "async": "^3.2.6",
30
30
  "authorized": "^1.0.0",
31
31
  "aws-sdk": "^2.1692.0",