Skip to content

A lightweight error/exception handling "framework" written in kotlin

Notifications You must be signed in to change notification settings

aetheric/fumbler

Repository files navigation

Fumbler

A lightweight error/exception handling "framework" written in kotlin

Usage

Include in your project:

<dependency>
	<groupId>nz.co.aetheric</groupId>
	<artifactId>fumbler</artifactId>
	<version>${version.fumbler}</version>
</dependency>

then provide it with the message bundle location and start building errors:

Fumbler fumbler = new Fumbler(MessageSource.load("messages"))
fumbler.err("some.error.key")
	.put("variable", "value")
	.cause(exception)
	.build() # Throws the exception.

Note: Each result from the builder is immutable, so messages can be prepared.

ErrBuilder builder = Fumbler.err("some.error")
		.put("some", "context")

if (condition) {
	builder.key("key1").build() # key: some.error.key1

} else {
	builder.key("key2").build() # key: some.error.key2
}

If you want to build a message without an error, you totally can.

MsgBuilder builder = Fumbler.msg("some.message")
		.put("some", "context")

validationMsgs.add(builder.key("key1").build())
validationMsgs.add(builder.key("key2").build())

About

A lightweight error/exception handling "framework" written in kotlin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages