浏览代码

[std] more information about catching errors

Rudy Ges 6 月之前
父节点
当前提交
b1fbc37d68
共有 2 个文件被更改,包括 11 次插入2 次删除
  1. 3 2
      std/haxe/macro/CompilationServer.hx
  2. 8 0
      std/haxe/macro/Context.hx

+ 3 - 2
std/haxe/macro/CompilationServer.hx

@@ -72,8 +72,9 @@ class CompilationServer {
 	/**
 		Invalidates a module, removing it from the cache.
 
-		If the module has already been loaded in current context, a compiler
-		error will be raised which can be caught using `try ... catch`.
+		If the module has already been loaded in current context, a
+		`haxe.macro.Expr.Error` compiler error will be raised which can be
+		caught using `try ... catch`.
 	**/
 	static public function invalidateModule(path:String) {
 		@:privateAccess Compiler.load("server_invalidate_module", 1)(path);

+ 8 - 0
std/haxe/macro/Context.hx

@@ -663,6 +663,10 @@ class Context {
 	/**
 		Defines a new type from `TypeDefinition` `t`.
 
+		If a matching module has already been loaded in current context, a
+		`haxe.macro.Expr.Error` compiler error will be raised which can be
+		caught using `try ... catch`.
+
 		If `moduleDependency` is given and is not `null`, it should contain
 		a module path that will be used as a dependency for the newly defined module
 		instead of the current module.
@@ -695,6 +699,10 @@ class Context {
 		Defines a new module as `modulePath` with several `TypeDefinition`
 		`types`. This is analogous to defining a .hx file.
 
+		If a matching module has already been loaded in current context, a
+		`haxe.macro.Expr.Error` compiler error will be raised which can be
+		caught using `try ... catch`.
+
 		The individual `types` can reference each other and any identifier
 		respects the `imports` and `usings` as usual, expect that imports are
 		not allowed to have `.*` wildcards or `as s` shorthands.