Merge pull request #675 from basecamp/command-errors
Show command errors
This commit is contained in:
@@ -64,6 +64,7 @@ export default class extends Controller {
|
||||
}
|
||||
|
||||
hideError() {
|
||||
this.#hideOutput()
|
||||
this.element.classList.remove(this.errorClass)
|
||||
}
|
||||
|
||||
@@ -113,13 +114,15 @@ export default class extends Controller {
|
||||
const status = response.status
|
||||
|
||||
if (status === HttpStatus.UNPROCESSABLE) {
|
||||
this.#showError()
|
||||
this.#showError(response)
|
||||
} else if (status === HttpStatus.CONFLICT) {
|
||||
await this.#handleConflictResponse(response)
|
||||
}
|
||||
}
|
||||
|
||||
#showError() {
|
||||
async #showError(response) {
|
||||
const message = await response.json()
|
||||
this.#showOutput(message.error)
|
||||
this.element.classList.add(this.errorClass)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user