try-catch-finally and throw error
This commit is contained in:
parent
c4883b9f2d
commit
b773523c30
@ -80,6 +80,18 @@ snippet try
|
|||||||
} catch (${2:e}) {
|
} catch (${2:e}) {
|
||||||
${0:/* handle error */}
|
${0:/* handle error */}
|
||||||
}
|
}
|
||||||
|
# try finally
|
||||||
|
snippet tryf
|
||||||
|
try {
|
||||||
|
${1}
|
||||||
|
} catch (${2:e}) {
|
||||||
|
${0:/* handle error */}
|
||||||
|
} finally {
|
||||||
|
${3:/* be executed regardless of the try / catch result*/}
|
||||||
|
}
|
||||||
|
# throw Error
|
||||||
|
snippet te
|
||||||
|
throw new Error('${1:error message}')
|
||||||
# return
|
# return
|
||||||
snippet ret
|
snippet ret
|
||||||
return ${0:result};
|
return ${0:result};
|
||||||
|
Loading…
Reference in New Issue
Block a user