Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] why this is only related to vue? #5

Closed
k1r0s opened this issue Aug 28, 2018 · 9 comments
Closed

[question] why this is only related to vue? #5

k1r0s opened this issue Aug 28, 2018 · 9 comments

Comments

@k1r0s
Copy link

k1r0s commented Aug 28, 2018

why this appears to work only in vue rather than every ES6 class?

@enkot
Copy link
Owner

enkot commented Aug 29, 2018

@k1r0s Thank you! I fixed title. The description left after another library. Since the first idea was to create a decorator for Vue using createDecorator method from vue-class-component. I use Vue components for examples only (as use case) and highlighted this in the first sentanse under "How to use?" section, but catch-decorator works with any ES/Typescript classes :)

@k1r0s
Copy link
Author

k1r0s commented Aug 29, 2018

Why you depend on

├─┬ catch-decorator@1.0.3
│ ├── vue@2.5.17
│ └── vue-class-component@6.2.0

@k1r0s
Copy link
Author

k1r0s commented Aug 29, 2018

It doens't work with static methods on ES6 classes

(node:17270) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'constructor' of undefined
    at runHandler (/home/k1r0s/Development/test-decorators/node_modules/catch-decorator/dist/index.js:84:80)
    at Function.<anonymous> (/home/k1r0s/Development/test-decorators/node_modules/catch-decorator/dist/index.js:111:36)
    at Generator.throw (<anonymous>)
    at rejected (/home/k1r0s/Development/test-decorators/node_modules/catch-decorator/dist/index.js:49:69)
    at <anonymous>
    at runMicrotasksCallback (internal/process/next_tick.js:121:5)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:695:11)
    at Object.<anonymous> (/home/k1r0s/Development/test-decorators/node_modules/@babel/node/lib/_babel-node.js:221:23)
(node:17270) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:17270) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@enkot
Copy link
Owner

enkot commented Aug 29, 2018

@k1r0s My mistake, I'll remove this dependencies (as I wrote, this are traces left from the previous lib).
Can you, please, create new issue related to static methods on ES6 classes?

@k1r0s
Copy link
Author

k1r0s commented Aug 29, 2018

I came across this repo bcoz you own https://www.npmjs.com/package/catch-decorator :))) and I have suggestions regarding on this repo

@k1r0s
Copy link
Author

k1r0s commented Aug 29, 2018

I can provide something that works everywhere and can be stacked:

@Throws(SyntaxError, "your expression is malformed")
@Throws(TypeError, "another message")
method() {
  asds() // bcoz this is a ReferenceError, exception isn't catched
}

and

@Throws(SyntaxError, "your expression is malformed")
@Throws(TypeError, "another message")
method() {
  mm1mm1m1,,1 // SyntaxError is throwed so its handled and "your expression is malformed" is returned
}

@k1r0s
Copy link
Author

k1r0s commented Aug 29, 2018

But I would like to publish under catch-decorator on npm. I can make a PR

@enkot
Copy link
Owner

enkot commented Aug 29, 2018

@k1r0s Good idea :) Feel free to open pull request with your description. There are many more nuances that can be implemented.

@k1r0s
Copy link
Author

k1r0s commented Sep 3, 2018

good luck

@k1r0s k1r0s closed this as completed Sep 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants