Skip to main content

report voluptuous errors

Project description

https://pepy.tech/badge/voluptuous_errors/month https://github.com/KenKundert/voluptuous_errors/actions/workflows/build.yaml/badge.svg https://coveralls.io/repos/github/KenKundert/voluptuous_errors/badge.svg?branch=master https://img.shields.io/pypi/v/voluptuous_errors.svg https://img.shields.io/pypi/pyversions/voluptuous_errors.svg
Author:

Ken Kundert

Version:

0.2

Released:

2026-06-28

A convenience function used for reporting voluptuous errors from nestedtext with inform. Here is a typical use of this function:

>>> from voluptuous import Schema, Invalid, MultipleInvalid, Required
>>> from voluptuous_errors import report_voluptuous_errors
>>> from inform import error, os_error, terminate
>>> import nestedtext as nt

>>>  try:
...      settings_path = Path('settings.nt')
...      settings = nt.load(
...          settings_path,
...          keymap = (keymap:={}),
...      )
...      settings = schema(settings)
>>>  except nt.NestedTextError as e:
...      e.report()
>>>  except MultipleInvalid as e:
...      report_voluptuous_errors(e, keymap, settings_path)
>>>  except OSError as e:
...      error(os_error(e))
>>>  terminate()

This code reports all errors found by Voluptuous when reading the settings file. It employs the NestedText keymap facility to annotate the error messages with helpful context such as line numbers.

You can map Voluptuous error messages by importing and modifying voluptuous_error_msg_mappings. For example:

voluptuous_error_msg_mappings["expected a table name"] = ("unknown table.", "key")

The value consists of two values, the new message, and the location they message refers to. This second value may be either “key” or “value”.

Releases

Latest development release

Version: 0.2
Released: 2026-06-28

0.2 (2026-06-28)

  • Return error count

0.1 (2026-06-10)

  • Improve error message (include value as codicil if appropriate).

0.0 (2024-02-25)

  • Initial version.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

voluptuous_errors-0.2.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

voluptuous_errors-0.2-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file voluptuous_errors-0.2.tar.gz.

File metadata

  • Download URL: voluptuous_errors-0.2.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for voluptuous_errors-0.2.tar.gz
Algorithm Hash digest
SHA256 7536ae63fdf0c9eebbf0a4a755f7307f3c85b5f0e53bcc234830b0f145b0907f
MD5 f391b308627df661c01d1f85abd697ae
BLAKE2b-256 fe9de36103a9fb56df1d5e82c2c95b8f41bf2e856ddc1a6fb36cee7fffe2500c

See more details on using hashes here.

File details

Details for the file voluptuous_errors-0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for voluptuous_errors-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6acb36e536be8810d61c9fc2c6d4d489c3b0c7f329a6d5f466dae9ce3eb952f5
MD5 beb901349111fa4b3e6969f11376578b
BLAKE2b-256 188c507be2fcafdce319c7776d2f95ec8b0e1ba9292cbdfba6422c964c33e9d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page