@netlify/edge-bundler 8.12.2 → 8.12.3
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.
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export default class ManifestValidationError extends Error {
|
|
2
2
|
constructor(message) {
|
|
3
3
|
super(`Validation of Edge Functions manifest failed\n${message}`);
|
|
4
|
+
this.customErrorInfo = {
|
|
5
|
+
type: 'functionsBundling',
|
|
6
|
+
};
|
|
4
7
|
this.name = 'ManifestValidationError';
|
|
5
8
|
// https://github.com/microsoft/TypeScript-wiki/blob/0fecbda7263f130c57394d779b8ca13f0a2e9123/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
6
9
|
Object.setPrototypeOf(this, ManifestValidationError.prototype);
|
|
@@ -45,6 +45,19 @@ test('should throw ManifestValidationError with correct message', () => {
|
|
|
45
45
|
expect(() => validateManifest('manifest')).toThrowError(ManifestValidationError);
|
|
46
46
|
expect(() => validateManifest('manifest')).toThrowError(/^Validation of Edge Functions manifest failed/);
|
|
47
47
|
});
|
|
48
|
+
test('should throw ManifestValidationError with customErrorInfo', () => {
|
|
49
|
+
try {
|
|
50
|
+
validateManifest('manifest');
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
expect(error).toBeInstanceOf(ManifestValidationError);
|
|
54
|
+
const { customErrorInfo } = error;
|
|
55
|
+
expect(customErrorInfo).toBeDefined();
|
|
56
|
+
expect(customErrorInfo.type).toBe('functionsBundling');
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
expect.fail('should have thrown');
|
|
60
|
+
});
|
|
48
61
|
test('should throw on additional property on root level', () => {
|
|
49
62
|
const manifest = getBaseManifest();
|
|
50
63
|
manifest.foo = 'bar';
|