File: Exceptions.php

package info (click to toggle)
php-luasandbox 4.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 620 kB
  • sloc: ansic: 3,700; xml: 2,152; php: 64; makefile: 13; sh: 3
file content (58 lines) | stat: -rw-r--r-- 1,209 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php

/**
 * Base class for LuaSandbox exceptions
 */
class LuaSandboxError extends Exception {
	const RUN = 2; // LUA_ERRRUN
	const SYNTAX = 3; // LUA_ERRSYNTAX
	const MEM = 4; // LUA_ERRMEM
	const ERR = 5; // LUA_ERRERR

	/**
	 * @var ?array
	 */
	public $luaTrace;
}

/**
 * Catchable LuaSandbox runtime exceptions
 *
 * These may be caught inside Lua using `pcall()` or `xpcall()`
 */
class LuaSandboxRuntimeError extends LuaSandboxError {
}

/**
 * Uncatchable LuaSandbox exceptions
 *
 * These may not be caught inside Lua using `pcall()` or `xpcall()`
 */
class LuaSandboxFatalError extends LuaSandboxError {
}

/**
 * Exception thrown when Lua code cannot be parsed
 */
class LuaSandboxSyntaxError extends LuaSandboxFatalError {
}

/**
 * Exception thrown when Lua cannot allocate memory
 * @see LuaSandbox::setMemoryLimit
 */
class LuaSandboxMemoryError extends LuaSandboxFatalError {
}

/**
 * Exception thrown when Lua encounters an error inside an error handler
 */
class LuaSandboxErrorError extends LuaSandboxFatalError {
}

/**
 * Exception thrown when the configured CPU time limit is exceeded
 * @see LuaSandbox::setCPULimit
 */
class LuaSandboxTimeoutError extends LuaSandboxFatalError {
}