use new predicates from library(error)

This commit is contained in:
Markus Triska
2020-04-27 17:42:05 +02:00
parent 2b1692a860
commit 8e1ba58551
7 changed files with 23 additions and 33 deletions

View File

@@ -13,13 +13,14 @@
:- use_module(library(format)).
:- use_module(library(iso_ext)).
:- use_module(library(error)).
max_sleep_time(0xfffffffffffffbff).
sleep(T) :-
builtins:must_be_number(T, sleep),
( T < 0 ->
throw(error(domain_error(not_less_than_zero, T), sleep/1))
domain_error(not_less_than_zero, T, sleep/1)
; max_sleep_time(N), T > N ->
throw(error(reprensentation_error(max_sleep_time), sleep/1))
; '$sleep'(T)