ResultObject<T>class for wrapping success values or errors in a single type-safe containerResultObject.ok(data)— create a success resultResultObject.err(error)— create an error result.isOk(),.isErr()— type-narrowing guards.hasData(),.isData()— aliases for.isOk().isError()— alias for.isErr()
- Unit test suite with Vitest (67 tests, ~99% coverage)
- Removed
toVerboseString()andverboseLog()— usetoDebugString()anddebugLog()instead
INCLUDE_DOMAIN_IN_STRINGstatic property to control whethertoString()includes the domain (default:false)INCLUDE_CODE_IN_STRINGstatic property to control whethertoString()includes the code (default:true)
toDebugString()now usesJSON.stringify(this, ...)to include all properties dynamically, prefixed with[DEBUG]toString()updated to respectINCLUDE_DOMAIN_IN_STRINGandINCLUDE_CODE_IN_STRING
- Renamed static constants:
DEFAULT_GENERIC_CODE→GENERIC_CODE,DEFAULT_GENERIC_MESSAGE→GENERIC_MESSAGE,DEFAULT_GENERIC_TAG→GENERIC_TAG - Removed
DEFAULT_DOMAIN— domain is no longer autopopulated from a static default
LOG_METHODstatic property to override the default log function (default:console.log)
_log()is nowprotectedinstead ofprivate, allowing subclasses to override logging behavior
_log()changed fromprivatetoprotected
- Removed
nextErrorsproperty andsetNextErrors()method - Removed multi-error logging in
_log()(no longer iterates overnextErrors)
toVerboseString()simplified totoDebugString()+JSON.stringify(this.raw)- Fixed
Object.setPrototypeOfto usenew.target.prototypefor proper subclassinstanceofsupport isErrorObject()now delegates toErrorObject.is()instead of duplicating the check- Cleaned up JSDoc comments
- Removed
SHOW_ERROR_LOGSstatic property - Removed
fallback()factory,isFallback()method, andDEFAULT_FALLBACK_TAG - Removed
summaryproperty andprocessingErrors/setProcessingErrors()
__isErrorObjectTypeDiscriminatorreadonly property for type discriminationErrorObject.is()static type guardisErrorObject()standalone type guard function- JSDoc for
withTag()
generic()now usesnew this(...)instead ofnew ErrorObject(...)for correct subclass supportnextErrorstype changed tothis[]- Code reformatted (single quotes → double quotes, indentation cleanup)
Version bump to serve as a clean dependency for @smbcheeky/error-object-from-payload.
- Removed
.fromPayload()static method and all builder/utils code — extracted to @smbcheeky/error-object-from-payload - Removed all exported utility types (
ErrorObjectBuildOptions,ErrorObjectProcessingError,ErrorSummary, etc.)