swift-bundler icon indicating copy to clipboard operation
swift-bundler copied to clipboard

Improve configuration deserialisation error messages

Open stackotter opened this issue 3 years ago • 2 comments

Currently the debug description of the deserialisation is just included in the error message for ConfigurationError.failedToDeserializeConfiguration. This is ok for now, but it takes quite a bit of reading to figure out what is wrong with your configuration. Configuration errors are common and they should be as easy to diagnose as possible.

It would be preferable to have some sort of custom error message for each command codable error. This could probably be done by adding LocalizedError conformance to whichever Codable related errors can be thrown. It could also be improved by adding nice error descriptions to all of the errors in TOMLKit.

TOMLKit also doesn't seem to provide a correct coding path (it's always empty from what I've seen).

stackotter avatar Mar 31 '22 23:03 stackotter

TOMLKit also doesn't seem to provide a correct coding path (it's always empty from what I've seen).

I’ve fixed that on this branch, could you try it out and see if it works for you?

LebJe avatar Apr 01 '22 23:04 LebJe

Yep, that seems to work! Thanks :)

stackotter avatar Apr 01 '22 23:04 stackotter

After @LebJe's improvements to TOMLKit's errors and improving PackageConfigurationError's LocalizedError implementation, configuration deserialization errors are now quite succint and informative. These changes are in the early access version which will soon be merged into this repo.

stackotter avatar Mar 07 '23 04:03 stackotter