Comments (5)
The issue raised by @jsiwrk needs addressing, however error messages are probably the wrong way to go about this because:
- Messages can change
- Messages are comprehensible by humans, but hard to parse
- Error messages my be incosistent without anyone really noticing it, as long as the stack traces are also interpreted (by a human) for additional context
- i18n
It is tempting tempting to simply move error messages into a ResourceBundle and be done with it, since this would solve all of these issues.
Personally, I'm a bit hesitant on this, as I am not sure whether I'm overlooking something.
I therefore welcome any input on this discussion!
from hcert-kotlin.
Initially I was thinking about returning a simple (and non-internationalized) error message, but as you say, it's true that this would limit the possible use cases of this feature (message recorded in application logs and interpreted by a human expert).
One option would be to introduce a secondary error code (similarly to the secondary status code of SAML). This (optional) secondary error code would refine the primary code when appropriate; e.g. to clarify the reason for CWT_EXPIRED.
Another option would be of course to augment the set of primary codes to render the secondary code unnecessary. (But this could not be appropriate if many additional codes were needed, or if a reduced/concise set of codes is required for interoperability/standardization reasons... I guess.)
A secondary code cannot convey as much information as an error message (e.g. the actual date that has been detected as expired), but this could not be necessary for the intended use case of this feature (deterministic processing by an application or non-expert human).
And there is also the option of returning both: a secondary error code for deterministic processing, and an internal error message for advanced diagnostics (that the application would typically log as is; no internationalization would be required). One could argue though that the internal logs of the library are sufficient for the latter purpose; but on the other hand, the application/service could prefer to handle the logging by itself.
To summarize: no idea of what's the best option either. ;-)
from hcert-kotlin.
Thanks for following up!
I did not think about contextual information such as the exact expiration date causing the expiry.
I still maintain that some "fixed" set of error codes/messages/… is the way to go, as it would have the nice side effect of all potential errors being enumerable.
When combining this with contextual information, using sealed classes for errors come to mind, as it would allow for adding additional information as desired and still implement an error handler fully capable of dealing with all bit of information ever produced.
from hcert-kotlin.
Proposed another simple alternative in PR #46, just to see how it looks. It's untyped and surely not as elegant as using sealed error classes, but maybe simpler is best in this case (?). Anyway, feel free to discard this PR without further explanation if you don't like it.
from hcert-kotlin.
GH-46 merged, thanks! I'll leave this open for now, since there are still some error cases, which do not utilise this new feature.
from hcert-kotlin.
Related Issues (20)
- Empty "dr" field
- Publish hcert-kotlin on npm HOT 2
- Integration questions HOT 2
- Data Classes for Business Rules HOT 1
- Debugging Issue with v.1.3.0 HOT 4
- Cose.kt?5e47:24 Uncaught TypeError: sign$Companion.createSync is not a function HOT 2
- Probably Wrong expirationTime? HOT 7
- HCERT DOB is weakly verified HOT 1
- Where can I find SignedDataDownloader? HOT 2
- javascript: Possible to inject clock? HOT 3
- metaInformation missing time/timezone information
- JVM library missing public constructors HOT 3
- Missing hcert-kotlin.js HOT 5
- cbor+BigInt and Safari <14 HOT 1
- Java Maven Integration HOT 7
- Offline Validation for more than 48h 7 VerificationException: Expiration<clock.now() HOT 5
- CWT_Expired Error on Check with a new 3/3 valid cert HOT 2
- Add Anonymisation feature to JS Target
- KEY_NOT_IN_TRUST_LIST error after certificate update HOT 4
- Update JS to IR Backend
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hcert-kotlin.