From 00d40140acb28c1740d9af4e441fda55f31f7492 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Mon, 17 Jun 2019 12:59:29 +0900 Subject: [PATCH] doc: add an example of error message to README --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 5072dc9..6a00be8 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,24 @@ terminate called after throwing an instance of 'toml::syntax_error' | ~~~~~~~ table defined twice ``` +When toml11 encounters a malformed value, it tries to detect what type it is. +Then it shows hints to fix the format. An error message while reading one of +the malformed files in [the language agnostic test suite](https://github.com/BurntSushi/toml-test). +is shown below. + +```console + what(): [error] bad time: should be HH:MM:SS.subsec + --> ./datetime-malformed-no-secs.toml + 1 | no-secs = 1987-07-05T17:45Z + | ^------- HH:MM:SS.subsec + | +Hint: OK: 1979-05-27T07:32:00, 1979-05-27 07:32:00.999999 +Hint: NG: 1979-05-27T7:32:00, 1979-05-27 7:32 +``` + +You can find other examples in a job named `output_result` on +[CircleCI](https://circleci.com/gh/ToruNiina/toml11). + Since the error message generation is generally a difficult task, the current status is not ideal. If you encounter a weird error message, please let us know and contribute to improve the quality!