Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
cc10dee3
Unverified
Commit
cc10dee3
authored
Feb 15, 2018
by
yann300
Committed by
GitHub
Feb 15, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #24 from ethereum/feedback
Feedback in case of error
parents
3ce31978
b533d239
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
11 deletions
+37
-11
router.js
src/router.js
+22
-9
sharedFolder.js
src/services/sharedFolder.js
+15
-2
No files found.
src/router.js
View file @
cc10dee3
...
...
@@ -19,16 +19,29 @@ class Router {
}
call
(
callid
,
name
,
fn
,
args
)
{
servicesList
[
name
][
fn
](
args
,
(
error
,
data
)
=>
{
var
response
=
{
id
:
callid
,
type
:
'reply'
,
scope
:
name
,
result
:
data
,
error
:
error
try
{
servicesList
[
name
][
fn
](
args
,
(
error
,
data
)
=>
{
var
response
=
{
id
:
callid
,
type
:
'reply'
,
scope
:
name
,
result
:
data
,
error
:
error
}
this
.
websocket
.
send
(
JSON
.
stringify
(
response
))
})
}
catch
(
e
)
{
var
msg
=
'Unexpected Error '
+
e
.
message
console
.
log
(
'
\
x1b[31m%s
\
x1b[0m'
,
'[ERR] '
+
msg
)
if
(
this
.
websocket
)
{
this
.
websocket
.
send
(
JSON
.
stringify
({
id
:
callid
,
type
:
'reply'
,
scope
:
name
,
error
:
msg
}))
}
this
.
websocket
.
send
(
JSON
.
stringify
(
response
))
})
}
}
}
...
...
src/services/sharedFolder.js
View file @
cc10dee3
...
...
@@ -12,7 +12,11 @@ module.exports = {
},
list
:
function
(
args
,
cb
)
{
cb
(
null
,
utils
.
walkSync
(
this
.
sharedFolder
,
{},
this
.
sharedFolder
))
try
{
cb
(
null
,
utils
.
walkSync
(
this
.
sharedFolder
,
{},
this
.
sharedFolder
))
}
catch
(
e
)
{
cb
(
e
.
message
)
}
},
resolveDirectory
:
function
(
args
,
cb
)
{
...
...
@@ -20,12 +24,15 @@ module.exports = {
var
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
sharedFolder
)
cb
(
null
,
utils
.
resolveDirectory
(
path
,
this
.
sharedFolder
))
}
catch
(
e
)
{
cb
(
e
)
cb
(
e
.
message
)
}
},
get
:
function
(
args
,
cb
)
{
var
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
sharedFolder
)
if
(
!
fs
.
existsSync
(
path
))
{
return
cb
(
'File not found '
+
path
)
}
if
(
!
isRealPath
(
path
,
cb
))
return
isbinaryfile
(
path
,
(
error
,
isBinary
)
=>
{
if
(
error
)
console
.
log
(
error
)
...
...
@@ -57,6 +64,9 @@ module.exports = {
rename
:
function
(
args
,
cb
)
{
var
oldpath
=
utils
.
absolutePath
(
args
.
oldPath
,
this
.
sharedFolder
)
if
(
!
fs
.
existsSync
(
oldpath
))
{
return
cb
(
'File not found '
+
oldpath
)
}
var
newpath
=
utils
.
absolutePath
(
args
.
newPath
,
this
.
sharedFolder
)
if
(
!
isRealPath
(
oldpath
,
cb
))
return
fs
.
move
(
oldpath
,
newpath
,
(
error
,
data
)
=>
{
...
...
@@ -67,6 +77,9 @@ module.exports = {
remove
:
function
(
args
,
cb
)
{
var
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
sharedFolder
)
if
(
!
fs
.
existsSync
(
path
))
{
return
cb
(
'File not found '
+
path
)
}
if
(
!
isRealPath
(
path
,
cb
))
return
fs
.
remove
(
path
,
(
error
,
data
)
=>
{
if
(
error
)
console
.
log
(
error
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment