{"id":23503527,"url":"https://github.com/realyuniquename/haxe-exception","last_synced_at":"2026-01-24T01:37:05.623Z","repository":{"id":36351731,"uuid":"40656499","full_name":"RealyUniqueName/Haxe-Exception","owner":"RealyUniqueName","description":"Base exception class for Haxe.","archived":false,"fork":false,"pushed_at":"2020-06-22T07:44:16.000Z","size":29,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-16T17:56:15.410Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haxe","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RealyUniqueName.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-13T12:02:16.000Z","updated_at":"2020-06-22T07:44:19.000Z","dependencies_parsed_at":"2022-09-06T06:01:35.102Z","dependency_job_id":null,"html_url":"https://github.com/RealyUniqueName/Haxe-Exception","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealyUniqueName%2FHaxe-Exception","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealyUniqueName%2FHaxe-Exception/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealyUniqueName%2FHaxe-Exception/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealyUniqueName%2FHaxe-Exception/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RealyUniqueName","download_url":"https://codeload.github.com/RealyUniqueName/Haxe-Exception/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252531882,"owners_count":21763293,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-25T08:30:05.365Z","updated_at":"2026-01-24T01:37:05.593Z","avatar_url":"https://github.com/RealyUniqueName.png","language":"Haxe","funding_links":[],"categories":[],"sub_categories":[],"readme":"Exception [![TravisCI Build Status](https://travis-ci.org/RealyUniqueName/Haxe-Exception.svg?branch=master)](https://travis-ci.org/RealyUniqueName/Haxe-Exception)\n=========\n\n`HaxeException` is the base class for your exceptions.\n\n**DEPRECATION NOTICE**\n\nAs of Haxe 4.1 standard library contains its own `haxe.Exception` type, which should be used instead of this library.\nSee https://haxe.org/manual/expression-throw.html#since-haxe-4.1.0 and https://haxe.org/manual/expression-try-catch.html#since-haxe-4.1\n\n**END OF DEPRECATION NOTICE**\n\nUsage\n--------\nCreating your own exceptions:\n```haxe\nclass TerribleErrorException extends HaxeException {}\n\nthrow new TerribleErrorException('OMG!');\n```\nWrapping third-party exceptions:\n```haxe\nimport HaxeException;\n\ntry {\n\tthrow 'Terrible error!';\n} catch (e:Dynamic) {\n\tthrow Exception.wrap(e);\n\t//or if you want to keep original exception stack\n\tthrow Exception.wrap(e).setStack(haxe.CallStack.exceptionStack());\n}\n```\nRethrowing exceptions:\n```haxe\nclass Test {\n\tstatic function fail() throw new HaxeException('OMG!');\n\n\tstatic function rethrow() {\n\t\ttry {\n\t\t\tfail();\n\t\t} catch(e:HaxeException) {\n\t\t\tthrow new HaxeException('Rethrown', e);\n\t\t}\n\t}\n\n\tstatic function doStuff() {\n\t\trethrow();\n\t}\n\n\tstatic public function main() {\n\t\ttry {\n\t\t\tdoStuff();\n\t\t} catch(e:HaxeException) {\n\t\t\ttrace(e);\n\t\t}\n\t}\n}\n```\nThat second exception will look like this when stringified:\n```\nTest.hx:22: Exception: OMG!\nStack:\nCalled from Test::fail line 4\nCalled from Test::rethrow line 8\n\nNext Exception: Rethrown\nStack:\nCalled from Test::rethrow line 10\nCalled from Test::doStuff line 15\nCalled from Test::main line 20\nCalled from StringBuf::$statics line 1\n```\n\nAPI\n-------\nModule `HaxeException`:\n```haxe\nclass HaxeException {\n\t/** Message of this exception. */\n\tpublic var message(default,null):String;\n\t/** Call stack of the line where this exception was created. */\n\tpublic var stack(default,null):Stack;\n\t/** Previously caught exception. */\n\tpublic var previous(default,null):Null\u003cHaxeException\u003e;\n\t/**\n\t *  Creates an instance of `HaxeException` using `e` as message.\n\t *  If `e` is already an instance of `HaxeException` then `e` is returned as-is.\n\t */\n\tstatic public inline function wrap (e:Dynamic):HaxeException;\n\t/**\n\t *  String representation of this exception.\n\t *  Includes message, stack and the previous exception (if set).\n\t */\n\tpublic function toString():String;\n}\n\n/**\n *  Call stack for exceptions\n */\n@:forward(length,copy)\nabstract Stack(Array\u003cStackItem\u003e) from Array\u003cStackItem\u003e to Array\u003cStackItem\u003e {\n\t/**\n\t *  Get current call stack.\n\t */\n\tpublic inline function new();\n\t/**\n\t *  Returns string representation of this call stack.\n\t */\n\tpublic inline function toString():String;\n\t/**\n\t *  Iterator to be able to iterate over items of this stack.\n\t */\n\tpublic inline function iterator():StackIterator\u003cStackItem\u003e;\n\t/**\n\t *  Array access for reading arbitrary items of this stack.\n\t */\n\t@:arrayAccess inline function get(index:Int):StackItem;\n\t/**\n\t *  Returns a range of entries of current stack from the beginning to the the common part of this and `stack`.\n\t */\n\tpublic function subtract(stack:Stack):Stack;\n}\n```\n------\nHappy throwing!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealyuniquename%2Fhaxe-exception","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frealyuniquename%2Fhaxe-exception","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealyuniquename%2Fhaxe-exception/lists"}