@defra/bng-errors-lib 0.236.0 → 0.237.0
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.
- package/package.json +2 -2
- package/src/errors.js +2 -0
- package/src/malware-detected-error.js +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defra/bng-errors-lib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.237.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Custom errors for Biodiversity Net Gain",
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
},
|
|
16
16
|
"author": "Department for Environment, Food and Rural Affairs <https://www.gov.uk/government/organisations/department-for-environment-food-rural-affairs>",
|
|
17
17
|
"license": "OGL-UK-3.0",
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "e4405983ffb9bd9d0a51816b4fb5665bb7c4f177"
|
|
19
19
|
}
|
package/src/errors.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import CoordinateSystemValidationError from './coordinate-system-validation-error.js'
|
|
2
2
|
import ThreatScreeningError from './threat-screening-error.js'
|
|
3
|
+
import MalwareDetectedError from './malware-detected-error.js'
|
|
3
4
|
import UnknownApplicationSessionIdError from './unknown-application-session-id-error.js'
|
|
4
5
|
import UploadTypeValidationError from './upload-type-validation-error.js'
|
|
5
6
|
import ValidationError from './validation-error.js'
|
|
@@ -30,6 +31,7 @@ const uploadWrittenConsentErrorCodes = Object.freeze({
|
|
|
30
31
|
export {
|
|
31
32
|
CoordinateSystemValidationError,
|
|
32
33
|
ThreatScreeningError,
|
|
34
|
+
MalwareDetectedError,
|
|
33
35
|
UnknownApplicationSessionIdError,
|
|
34
36
|
UploadTypeValidationError,
|
|
35
37
|
ValidationError,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Adapted from https://medium.com/@xjamundx/custom-javascript-errors-in-es6-aa891b173f87
|
|
2
|
+
export default class MalwareDetectedError extends Error {
|
|
3
|
+
constructor (threatScreeningDetails, ...args) {
|
|
4
|
+
super(...args)
|
|
5
|
+
this.threatScreeningDetails = threatScreeningDetails
|
|
6
|
+
Error.captureStackTrace(this, MalwareDetectedError)
|
|
7
|
+
}
|
|
8
|
+
}
|