changeset 1084:aa967fd73b80

improve error message
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 26 Nov 2016 20:51:14 -0700
parents e7fb974e0c26
children a04da9a3e9eb
files src/luan/modules/Time.luan
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/luan/modules/Time.luan	Mon Nov 21 22:48:43 2016 -0700
+++ b/src/luan/modules/Time.luan	Sat Nov 26 20:51:14 2016 -0700
@@ -3,6 +3,7 @@
 java()
 local Luan = require "luan:Luan.luan"
 local error = Luan.error
+local assert_long = Luan.assert_long or error()
 local ipairs = Luan.ipairs or error()
 local Math = require "luan:Math.luan"
 local floor = Math.floor or error()
@@ -43,6 +44,7 @@
 end
 
 function M.format(time,pattern)
+	time = assert_long(time)
 	pattern = pattern or "yyyy-MM-dd HH:mm:ss"
 	return SimpleDateFormat.new(pattern).format(Date.new(time))
 end