-
Notifications
You must be signed in to change notification settings - Fork 3
feat(backend): backend error handling strategy #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
5d3a8e7
feat(backend): update chatSync calls to use structured message format…
Sma1lboy 52d587a
refactor(backend): simplify chat input type and clean up unused embed…
Sma1lboy 47d7e43
feat(backend): enhance test utilities and improve markdown output for…
Sma1lboy d5bf1b9
chore: update documentation for improved clarity and consistency
Sma1lboy 89fd2f3
[autofix.ci] apply automated fixes
autofix-ci[bot] 88d79db
fix: deleting useless embedding module and adding tests for openai em…
NarwhalChen 1ff5a5d
feat: adding retryable error handler
NarwhalChen ebc2daa
Merge branch 'main' of https://github.com/Sma1lboy/codefox into featu…
NarwhalChen 169556e
feat: merging useless promise set and updating ux handler to newet ve…
NarwhalChen 18b12ad
[autofix.ci] apply automated fixes
autofix-ci[bot] 269d740
fix: Undelete false delete during merge
NarwhalChen ce77412
Merge branch 'feature-backend-error-handling-strategy' of https://git…
NarwhalChen 988b0ba
Merge branch 'main' of https://github.com/Sma1lboy/codefox into featu…
NarwhalChen bbba977
feat: deleting repeat retry in file arch
NarwhalChen 7c4d783
feat: adding retryable error and non retryable error for retry handler
NarwhalChen 5ed11e7
[autofix.ci] apply automated fixes
autofix-ci[bot] 2daed38
feat: adapting all handlers to retry handler
NarwhalChen 3296a80
Merge branch 'feature-backend-error-handling-strategy' of https://git…
NarwhalChen 317c690
[autofix.ci] apply automated fixes
autofix-ci[bot] bb7b3d7
feat: support detail error in handler
NarwhalChen 2d2bb8d
[autofix.ci] apply automated fixes
autofix-ci[bot] cf221cb
feat: removing useless error
NarwhalChen 370a453
fix: fixing wrong version of fullstack test
NarwhalChen 4718272
[autofix.ci] apply automated fixes
autofix-ci[bot] 0654d78
fix: update prompt handling and improve regex for section extraction
Sma1lboy 25ac7d8
fix: add handling for ResponseParsingError in retry logic
Sma1lboy 3f3dc91
refactor: remove unused error classes and improve error handling in r…
Sma1lboy 85c09f1
refactor: introduce base error classes for retryable and non-retryabl…
Sma1lboy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
12 changes: 0 additions & 12 deletions
12
backend/src/build-system/__tests__/test.model-provider.spec.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,149 @@ | ||
// error.ts | ||
|
||
/** | ||
* Base class representing retryable errors. | ||
* Inherits from JavaScript's built-in Error class. | ||
* Suitable for errors where the system can attempt to retry the operation. | ||
*/ | ||
export class RetryableError extends Error { | ||
constructor(message: string) { | ||
super(message); | ||
this.name = 'RetryableError'; | ||
Object.setPrototypeOf(this, new.target.prototype); // Fixes the inheritance chain for instanceof checks | ||
} | ||
} | ||
|
||
/** | ||
* Base class representing non-retryable errors. | ||
* Inherits from JavaScript's built-in Error class. | ||
* Suitable for errors where the system should not attempt to retry the operation. | ||
*/ | ||
export class NonRetryableError extends Error { | ||
constructor(message: string) { | ||
super(message); | ||
this.name = 'NonRetryableError'; | ||
Object.setPrototypeOf(this, new.target.prototype); // Fixes the inheritance chain for instanceof checks | ||
} | ||
} | ||
|
||
// Below are specific error classes inheriting from the appropriate base classes | ||
|
||
/** | ||
* Error: File Not Found. | ||
* Indicates that a required file could not be found during file operations. | ||
* Non-retryable error. | ||
*/ | ||
export class FileNotFoundError extends NonRetryableError { | ||
constructor(message: string) { | ||
super(message); | ||
this.name = 'FileNotFoundError'; | ||
} | ||
} | ||
|
||
/** | ||
* Error: File Modification Failed. | ||
* Indicates issues encountered while modifying a file, such as insufficient permissions or disk errors. | ||
* Non-retryable error. | ||
*/ | ||
export class FileModificationError extends NonRetryableError { | ||
constructor(message: string) { | ||
super(message); | ||
this.name = 'FileModificationError'; | ||
} | ||
} | ||
|
||
/** | ||
* Error: Model Service Unavailable. | ||
* Indicates that the underlying model service cannot be reached or is down. | ||
* Retryable error, typically temporary. | ||
*/ | ||
export class ModelUnavailableError extends RetryableError { | ||
constructor(message: string) { | ||
super(message); | ||
this.name = 'ModelUnavailableError'; | ||
} | ||
} | ||
|
||
/** | ||
* Error: Response Parsing Failed. | ||
* Indicates that the system could not properly parse the response data. | ||
* Retryable error, possibly due to temporary data format issues. | ||
*/ | ||
export class ResponseParsingError extends RetryableError { | ||
constructor(message: string) { | ||
super(message); | ||
this.name = 'ResponseParsingError'; | ||
} | ||
} | ||
|
||
/** | ||
* Error: Response Tag Error. | ||
* Indicates that expected tags in the response are missing or invalid during content generation or parsing. | ||
* Non-retryable error. | ||
*/ | ||
export class ResponseTagError extends NonRetryableError { | ||
constructor(message: string) { | ||
super(message); | ||
this.name = 'ResponseTagError'; | ||
} | ||
} | ||
|
||
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. adding long description for each erorr |
||
/** | ||
* Error: Temporary Service Unavailable. | ||
* Indicates that the service is unavailable due to temporary issues like server overload or maintenance. | ||
* Retryable error, typically temporary. | ||
*/ | ||
export class TemporaryServiceUnavailableError extends RetryableError { | ||
constructor(message: string) { | ||
super(message); | ||
this.name = 'TemporaryServiceUnavailableError'; | ||
} | ||
} | ||
|
||
/** | ||
* Error: Rate Limit Exceeded. | ||
* Indicates that too many requests have been sent within a given time frame. | ||
* Retryable error, may require waiting before retrying. | ||
*/ | ||
export class RateLimitExceededError extends RetryableError { | ||
constructor(message: string) { | ||
super(message); | ||
this.name = 'RateLimitExceededError'; | ||
} | ||
} | ||
|
||
/** | ||
* Error: Missing Configuration. | ||
* Indicates issues with system setup or missing configuration parameters. | ||
* Non-retryable error, typically requires manual configuration fixes. | ||
*/ | ||
export class MissingConfigurationError extends NonRetryableError { | ||
constructor(message: string) { | ||
super(message); | ||
this.name = 'MissingConfigurationError'; | ||
} | ||
} | ||
|
||
/** | ||
* Error: Invalid Parameter. | ||
* Indicates that a function argument or configuration parameter is invalid. | ||
* Non-retryable error, typically requires correcting the input parameters. | ||
*/ | ||
export class InvalidParameterError extends NonRetryableError { | ||
constructor(message: string) { | ||
super(message); | ||
this.name = 'InvalidParameterError'; | ||
} | ||
} | ||
|
||
/** | ||
* Error: File Write Failed. | ||
* Indicates issues encountered while writing to a file, such as insufficient permissions or disk errors. | ||
* Non-retryable error. | ||
*/ | ||
export class FileWriteError extends NonRetryableError { | ||
constructor(message: string) { | ||
super(message); | ||
this.name = 'FileWriteError'; | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.