jonasroussel / dart_jsonwebtoken

A dart implementation of the famous javascript library 'jsonwebtoken'
MIT License
87 stars 29 forks source link

Implementing Exception instead of extending Error #39

Closed bytes7bytes7 closed 1 year ago

bytes7bytes7 commented 1 year ago

You have the JWTError class that extends Error. But, I think, that in this situation, JWTError should implements Exception. A good explanation you can find here

And also it would be better to rename JWTError to JWTException (and all inheritors too: JWTInvalidError, JWTExpiredError, etc.)

class JWTException implements Exception {
  JWTException(this.message);

  final String message;

  @override
  String toString() => 'JWTException: $message';
}
jonasroussel commented 1 year ago

You are right. I will see how it will impact the existing code for users of the package. But I'll probably do an update soon.

jonasroussel commented 1 year ago

Sorry for the lengthy delay in making these changes, I got a lot of works in my job recently (got promoted CTO).

Latest version (v2.8.1): pub: https://pub.dev/packages/dart_jsonwebtoken/versions/2.8.1 github: https://github.com/jonasroussel/dart_jsonwebtoken/tree/v2.8.1

ahmednfwela commented 1 year ago

this should've been a major version pump, not a minor one. It's breaking dependent packages @jonasroussel

jonasroussel commented 1 year ago

I'm really sorry about these changes and the problem they caused to your CI.

I was not aware of the fact that pub can update the minor version automatically. I was convinced that pub could only change the "fix" version (2.8.x).

Thanks for the info.