1.1.4 • Published 2 years ago

handsome-exception v1.1.4

Weekly downloads
1
License
MIT
Repository
github
Last release
2 years ago

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>
1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

5 years ago

1.0.0

5 years ago