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

Bugfix/bai 918 model card errors #950

Merged
merged 2 commits into from
Dec 13, 2023
Merged

Conversation

ARADDCC012
Copy link
Member

No description provided.


const response = await postFromSchema(model.id, newSchema.id)

if (response.status && response.status < 400) {
Copy link
Member

Choose a reason for hiding this comment

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

Should this not be if(!response.ok) ?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's an axios request so the response doesn't have an ok property. The response.statusText will be 'OK' if the response.status is 200, but we parse the response through handleAxiosError which ignores the statusText. If we want to change this I'd argue we can easily do it later on.

@@ -34,12 +35,15 @@ export default function FormEditPage({ model }: FormEditPageProps) {

async function onSubmit() {
if (schema) {
setErrorMessage('')
setLoading(true)
const data = getStepsData(splitSchema, true)
const res = await putModelCard(model.id, data)
if (res.status && res.status < 400) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we use if (!res.ok)

Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -66,6 +66,7 @@ export const getErrorMessage = async (res: Response) => {
messageError = `${res.statusText}: ${(await res.json()).error.message}`
} catch (e) {
// unable to identify error message, possibly a network failure
return 'Unknown error - Please contact Bailo support'
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to put a link directly to our help page here?

Copy link
Member Author

Choose a reason for hiding this comment

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

It would be nice to, but this is just a util function that returns a string. We'd need additional logic everywhere it's being used to route the user to that page in the event of this happening.

I'm not against us doing that, but this isn't strictly a part of this ticket. I just noticed we weren't providing any feedback in this very niche scenario, so figured I'd put at least something in.

We can raise a ticket to address this if you want?

@ARADDCC012 ARADDCC012 merged commit 3cc3a86 into main Dec 13, 2023
@ARADDCC012 ARADDCC012 deleted the bugfix/BAI-918-model-card-errors branch December 13, 2023 12:10
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