object Error extends Serializable
Constructs Error objects
An error may be created using either an explicit or implicit MessageBundle. The bundle defines the resource (class) containing the language specific error strings.
Example:
implicit bundle MessageBundle("Errors") val err1 = Error("ErrorCode") val err2 = Error(MessageBundle("Errors"), "ErrorCode")
The MessageBundle
is generally defined implicitly in package.scala
making it available to all code within the enclosed package. Error
strings may be placed in a separate resource bundle from general
messages.
When and error is created the message
label is set to the error
message (Message) and code
is set
to the error code (java.lang.String
).
- Source
- Error.scala
- Alphabetic
- By Inheritance
- Error
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def apply(message: Message): Error
Create an Error from an existing
Message
Create an Error from an existing
Message
A new
Error
is created using the suppliedMessage
as themessage
property and theMessage.code
as thecode
property.- message
to be used as error message
- returns
language independent
Error
object
- def apply(bundle: MessageBundle, code: String, args: Any*): Error
Create an Error using an explicit
MessageBundle
.Create an Error using an explicit
MessageBundle
.Example:
val error = Error(MessageBundle("Errors"), "ErrorCode")
The
Error
created extracts the error message from the supplied resource bundle. The resources associated with the bundle are generally found in the packages "resources" sub-directory.- bundle
from which to extract the
code
error message- code
identifying the error message to use
- args
interpolated into the error message when displayed
- returns
language independent
Error
object
- def apply(code: String, args: Any*)(implicit bundle: MessageBundle): Error
Creates an Error using an implicit
MessageBundle
.Creates an Error using an implicit
MessageBundle
.Example:
implicit bundle MessageBundle("Errors") val error = Error("ErrorCode")
The returned
Error
contains the error description in a language independent way. The implicitMessageBundle
is normally defined in apackage.scala
file and used by all code in the package. The resources associated with the bundle are generally found in the packages "resources" sub-directory.- code
identifying the error message to be used
- args
interpolated into the message when displayed
- bundle
from which to extract the
code
error message (implicit)- returns
language independent
Error
object
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
Documentation for the Axiell Utilities Project
Overview
The Axiell Utilities Project attempts to provide a small library of classes and object applicable to most Axiell developments. The library is not geared towards any one project and so should be useful for new projects as well as existing ones.
The library is based on a few simple principles, namely:
Package structure
The
package consists of a number of utilities, where each utility provides a single piece of functionality.com.axiell.util
Notable utilities are:
Configure
generic configuration reader allowing application settings defined as resources to be interrogated.Error
generic error handling class defining a locale independent error message along with details relating to the context of the error. The context may include an exception and other relevant values.Formatter
retrieves and formats a locale specific string from a specified resource bundle. The formatting is specified in aC
printf style.Implicits
implements implicit methods and classes used to pimp methods onto existing classes (e.g.fold()
method toBoolean
class) and to provide implicit implementations for the JsonLocal and ShowLocal type classes.JsonLocal
type class used to output locale specific JSON structures. Implementations exist for Message and Error.Message
provides a locale independent mechanism for handling strings. The strings for a given locale are stored in resource bundles that are accessed when the message is to be displayed.ShowLocal
type class used to show locale specific strings. Allows Message and Error to be converted to a given language string.Dependencies
The list of dependencies are:
Typesafe Config
a generic configuration file reader. The library is used by theConfigure
class to access settings stored as resources within an application.