This repository has been archived by the owner on May 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
fix: annotate ISC errors and split into to separate errors #1146
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c760fec
fix: annotate ISC errors and split into to separate errors
danez 5e373ee
chore: refactor all other places
danez df6578a
Merge branch 'main' into fix/danez/error-message
danez 1a7f7d2
chore: remove unused function and fix types
danez ca1c15a
Merge branch 'fix/danez/error-message' of github.com:netlify/zip-it-aβ¦
danez f8d68e4
Merge branch 'main' into fix/danez/error-message
kodiakhq[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { NodeBundlerName } from '../runtimes/node/bundlers' | ||
import { RuntimeName } from '../runtimes/runtime' | ||
|
||
interface CustomErrorInfo { | ||
type: 'functionsBundling' | ||
location: { | ||
functionName: string | ||
runtime: RuntimeName | ||
bundler?: NodeBundlerName | ||
} | ||
} | ||
|
||
export class FunctionBundlingUserError extends Error { | ||
danez marked this conversation as resolved.
Show resolved
Hide resolved
|
||
customErrorInfo: CustomErrorInfo | ||
|
||
constructor( | ||
message: string, | ||
customErrorInfo: { | ||
functionName: string | ||
runtime: RuntimeName | ||
bundler?: NodeBundlerName | ||
}, | ||
) { | ||
super(message) | ||
|
||
Object.setPrototypeOf(this, new.target.prototype) | ||
this.name = 'FunctionBundlingUserError' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These two lines are necessary because typescript does not support extending builtins completely |
||
|
||
this.customErrorInfo = { type: 'functionsBundling', location: customErrorInfo } | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
tests/fixtures/in-source-config/functions/cron_esm_schedule_multi_import.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// eslint-disable-next-line n/no-unsupported-features/es-syntax | ||
import { schedule } from '@netlify/functions' | ||
import { schedule as schedule2 } from '@netlify/functions' | ||
|
||
export const handler = schedule2('@daily', () => {}) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the logic a little because all we care if
schedule
was imported once, if someone imports multiple times, then that is fine too as long as one of the imports is used and exported.π€·ββοΈ