dhx.try 0.0.4

Scala inspired Try operator

Released 2017-03-06.

To install, run:

haxelib install dhx.try 0.0.4

See using Haxelib in Haxelib documentation for more information.

Maintainerdeep
Websitehttps://github.com/profelis/dhx.try
Current version0.0.4
StatisticsInstalled 4 times
LicenseMIT
Tags catch, cross, try, utils

README.md

Scala inspired Try operator

Build Status

Haxelib: http://lib.haxe.org/p/dhx.try/

Scala API: http://www.scala-lang.org/api/current/scala/util/Try.html

Posts: http://danielwestheide.com/blog/2012/12/26/the-neophytes-guide-to-scala-part-6-error-handling-with-try.html

Usage:

import dhx.Try;
import dhx.Try.Macro.Try;   // macro magic
using dhx.Tries;        // useful extensions
...
var tried:Try<Int> = Try(someUnsafeOperation(foo, bar));
tried.LogFailure(); // trace exception or set define `debug_try`
var value = tried.getOrElse(function () return 0);

Global Import

import.hx

import dhx.Try;
import dhx.Try.Macro.Try;
using dhx.Tries;

Debug

  • define debug_try - turn on exceptions log