Skip to content
Snippets Groups Projects
Commit dca93d8c authored by Jakob Karevold Grønhaug's avatar Jakob Karevold Grønhaug
Browse files

Merge branch 'calculator-js-error-handling' into 'master'

Add error handling to calculator JS

See merge request !2
parents d0573909 26f05c60
Branches
No related tags found
1 merge request!2Add error handling to calculator JS
Pipeline #157971 passed
......@@ -39,7 +39,14 @@ function submitExpression(event){
},
body: expression
})
.then(response => response.text())
.then(response => {
if (response.ok) {
return response.text()
} else {
return "Unable to parse your message, please try again"
}
}
)
.then(solution => createReceivedMessageElement({"messageContent": solution}))
.catch(error => console.error(error));
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment