From fbfe12dad837300942fc4bf0a3f927b25eaf50a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Tue, 26 Jan 2016 08:11:00 +0100 Subject: Update documentation for code-loading functions Some of the error reasons were not explained. --- lib/kernel/doc/src/code.xml | 61 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 14 deletions(-) (limited to 'lib/kernel/doc') diff --git a/lib/kernel/doc/src/code.xml b/lib/kernel/doc/src/code.xml index eb0f4b7a06..1bd52040a0 100644 --- a/lib/kernel/doc/src/code.xml +++ b/lib/kernel/doc/src/code.xml @@ -287,6 +287,46 @@ was given to set_path/1).

+
+ + Error Reasons for Code-Loading Functions + +

Functions that load code (such as load_file/1) will + return {error,Reason} if the load operation fails. + Here follows a description of the common reasons.

+ + + badfile + +

The object code has an incorrect format or the module + name in the object code is not the expected module name.

+
+ + nofile + +

No file with object code was found.

+
+ + not_purged + +

The object code could not be loaded because an old version + of the code already existed.

+
+ + on_load_failure + +

The module has an + -on_load function + that failed when it was called.

+
+ + sticky_directory + +

The object code resides in a sticky directory.

+
+ +
+
@@ -411,12 +451,8 @@ be used to load object code with a module name that is different from the file name.

Returns {module, Module} if successful, or - {error, nofile} if no object code is found, or - {error, sticky_directory} if the object code resides in - a sticky directory. Also if the loading fails, an error tuple is - returned. See - erlang:load_module/2 - for possible values of What.

+ {error, Reason} if loading fails. + See Error Reasons for Code-Loading Functions for a description of the possible error reasons.

@@ -428,7 +464,7 @@

Does the same as load_file(Module), but Filename is either an absolute file name, or a - relative file name. The code path is not searched. It returns + relative file name. The code path is not searched. It returns a value in the same way as load_file/1. Note that Filename should not contain the extension (for @@ -444,7 +480,8 @@ load_file/1, unless the module is already loaded. In embedded mode, however, it does not load a module which is not - already loaded, but returns {error, embedded} instead.

+ already loaded, but returns {error, embedded} instead. + See Error Reasons for Code-Loading Functions for a description of other possible error reasons.

@@ -461,12 +498,8 @@ comes. Accordingly, Filename is not opened and read by the code server.

Returns {module, Module} if successful, or - {error, sticky_directory} if the object code resides in - a sticky directory, or {error, badarg} if any argument - is invalid. Also if the loading fails, an error tuple is - returned. See - erlang:load_module/2 - for possible values of What.

+ {error, Reason} if loading fails. + See Error Reasons for Code-Loading Functions for a description of the possible error reasons.

-- cgit v1.2.3