Skip to content
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

add expose FilFox error code #2

Merged
merged 1 commit into from
Sep 26, 2024
Merged

Conversation

juliangruber
Copy link
Member

In order for spark-evaluate to ignore FilFox errors, expose them with their own code first.

For filecoin-station/spark-evaluate#363 (comment)

@juliangruber
Copy link
Member Author

throw new Error(`Filfox request failed with ${res.status}: ${(await res.text()).trimEnd()}`)
const err = new Error(`Filfox request failed with ${res.status}: ${(await res.text()).trimEnd()}`)
err.code = 'FILFOX_REQUEST_FAILED'
throw err
}
const body = await res.json()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we set err.code also when res.json() throws while reading the response body?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could, but it hasn't happened yet, and might never, so I would like not to spend the extra time on it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But happy to review a PR!

@juliangruber juliangruber merged commit 7eecbaa into main Sep 26, 2024
1 check passed
@juliangruber juliangruber deleted the add/expose-filfox-error branch September 26, 2024 09:07
@juliangruber
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants