changeset 379:e9e445e28f0b

add error checking to Hosting
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 20 Apr 2015 12:24:54 -0600
parents bf60da9298f5
children 6c6c3537035e
files core/src/luan/modules/host/Hosting.luan
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
diff -r bf60da9298f5 -r e9e445e28f0b core/src/luan/modules/host/Hosting.luan
--- a/core/src/luan/modules/host/Hosting.luan	Sun Apr 19 19:12:36 2015 -0600
+++ b/core/src/luan/modules/host/Hosting.luan	Mon Apr 20 12:24:54 2015 -0600
@@ -1,10 +1,16 @@
 -- Hosting
 
 local Io = require "luan:Io"
+local Luan = require "luan:Luan"
+local error = Luan.error
+
 
 port = 9101
 
 function push(domain,password,dir)
+	local f = Io.Uri("file:"..dir)
+	f.exists() or error("directory '"..dir.."' not found")
+	f.is_directory() or error("'"..dir.."' is not a directory")
 	local socket = "socket:" .. domain .. ":" .. port
 	local pc = Io.Uri(socket).Pickle_client()
 	local pickle = pc.pickle