Exceptions

From Onix OS Wiki
Jump to: navigation, search

Exception management is an array that allows you to check whether an error has occurred depending on an object. The content is checked to see if there is an error, or to the end if no error has occurred.

Definition =

Begin is used to control an object.

begin object{
......
}

“Expect” and “recover” are used to debug and print out errors. Automatic “error” identification is done. In this way, we can use this definition as an internal variable.


Example

def test = "hello"
begin object{
	if (test == "hello"){
		except test "Hello is not usefull. Please use Hi on project."
	}
	recover test{
		println(error)
	}
}

If no errors are received, “final” is used. If there is no error in this way, the values in “final” are automatically executed.

def test = "hello"
begin object{
	if (test == "hello"){
		except test "Hello is not usefull."
	}
	recover object{
		println(error)
	}
	final object{
		println("Hello is not used. Yay!")
	}
}

This is how we debug it. Exception detection can be used in this way.