handsome-exception
v1.1.4
Published
exceptions handler for error when chained calling from object
Downloads
4
Maintainers
Readme
English | 中文
handsome-exception
simple exceptions handler for error when chained calling from object
Install
npm install --save handsome-exception
Usage
import handler from 'handsome-exception';
let obj = handler({name: 'jack'}, 'exception!');
console.log(obj.name()); // jack
console.log(obj.name.a.b.c.d()); // exception!
console.log(obj.e.r.r.o.r('other exception!')); // other exception!
Template syntax(vue)
<template>
<div id="handsome">
{{obj.name()}} <!-- jack -->
{{obj.e.r.r.o.r()}} <!-- exception! -->
{{obj.e.r.r.o.r("other exception!")}} <!-- other exception! -->
</div>
</template>
<script>
import handler from 'handsome-exception';
export default {
name: 'handsome',
data() {
return {
obj: null
}
},
created() {
this.obj = handler({name: 'jack'}, 'exception!');
},
methods: {
}
}
</script>
<style scoped>
</style>