consistently use finally {} for cleanup in html/js

This commit is contained in:
Mechiel Lukkien 2023-02-06 15:23:33 +01:00
parent 6cbe4d5d37
commit 37713a974c
No known key found for this signature in database
2 changed files with 20 additions and 19 deletions

View file

@ -161,7 +161,7 @@ const index = async () => {
window.alert('Password has been changed.')
form.reset()
} catch (err) {
console.log('error', err)
console.log({err})
window.alert('Error: ' + err.message)
} finally {
fieldset.disabled = false
@ -193,7 +193,7 @@ const init = async () => {
dom._kids(page, 'page not found')
}
} catch (err) {
console.log('error', err)
console.log({err})
window.alert('Error: ' + err.message)
window.location.hash = curhash
curhash = window.location.hash

View file

@ -216,10 +216,10 @@ const index = async () => {
} catch (err) {
console.log({err})
window.alert('Error: ' + err.message)
fieldset.disabled = false
return
} finally {
fieldset.disabled = false
}
fieldset.disabled = false
window.location.hash = '#domains/' + domain.value
},
fieldset=dom.fieldset(
@ -433,10 +433,10 @@ const accounts = async () => {
} catch (err) {
console.log({err})
window.alert('Error: ' + err.message)
fieldset.disabled = false
return
} finally {
fieldset.disabled = false
}
fieldset.disabled = false
window.location.hash = '#accounts/'+account.value
},
fieldset=dom.fieldset(
@ -515,10 +515,10 @@ const account = async (name) => {
} catch (err) {
console.log({err})
window.alert('Error: ' + err.message)
e.target.disabled = false
return
} finally {
e.target.disabled = false
}
e.target.disabled = false
window.location.reload() // todo: reload just the list
}),
),
@ -545,10 +545,10 @@ const account = async (name) => {
} catch (err) {
console.log({err})
window.alert('Error: ' + err.message)
fieldset.disabled = false
return
} finally {
fieldset.disabled = false
}
fieldset.disabled = false
form.reset()
window.location.reload() // todo: only reload the destinations
},
@ -585,8 +585,9 @@ const account = async (name) => {
window.alert('Password has been changed.')
formPassword.reset()
} catch (err) {
console.log('error', err)
console.log({err})
window.alert('Error: ' + err.message)
return
} finally {
fieldsetPassword.disabled = false
}
@ -605,10 +606,10 @@ const account = async (name) => {
} catch (err) {
console.log({err})
window.alert('Error: ' + err.message)
e.target.disabled = false
return
} finally {
e.target.disabled = false
}
e.target.disabled = false
window.location.hash = '#accounts'
}),
)
@ -689,10 +690,10 @@ const domain = async (d) => {
} catch (err) {
console.log({err})
window.alert('Error: ' + err.message)
e.target.disabled = false
return
} finally {
e.target.disabled = false
}
e.target.disabled = false
window.location.reload() // todo: only reload the localparts
}),
),
@ -712,10 +713,10 @@ const domain = async (d) => {
} catch (err) {
console.log({err})
window.alert('Error: ' + err.message)
fieldset.disabled = false
return
} finally {
fieldset.disabled = false
}
fieldset.disabled = false
form.reset()
window.location.reload() // todo: only reload the addresses
},
@ -755,10 +756,10 @@ const domain = async (d) => {
} catch (err) {
console.log({err})
window.alert('Error: ' + err.message)
e.target.disabled = false
return
} finally {
e.target.disabled = false
}
e.target.disabled = false
window.location.hash = '#'
}),
)