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
a591fd20
Commit
a591fd20
authored
Sep 10, 2016
by
Alex Beregszaszi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move HTTP (and Github API) error handling to app from compiler.
Also introduces finer error reporting why the import failed (404, 300, etc.)
parent
7a215cf4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
13 deletions
+21
-13
app.js
src/app.js
+12
-1
compiler.js
src/app/compiler.js
+9
-12
No files found.
src/app.js
View file @
a591fd20
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
var
$
=
require
(
'jquery'
);
var
$
=
require
(
'jquery'
);
var
semver
=
require
(
'semver'
);
var
semver
=
require
(
'semver'
);
var
Base64
=
require
(
'js-base64'
).
Base64
;
var
utils
=
require
(
'./app/utils'
);
var
utils
=
require
(
'./app/utils'
);
var
QueryParams
=
require
(
'./app/query-params'
);
var
QueryParams
=
require
(
'./app/query-params'
);
...
@@ -403,7 +404,17 @@ var run = function () {
...
@@ -403,7 +404,17 @@ var run = function () {
function
handleGithubCall
(
root
,
path
,
cb
)
{
function
handleGithubCall
(
root
,
path
,
cb
)
{
$
(
'#output'
).
append
(
$
(
'<div/>'
).
append
(
$
(
'<pre/>'
).
text
(
'Loading github.com/'
+
root
+
'/'
+
path
+
' ...'
)));
$
(
'#output'
).
append
(
$
(
'<div/>'
).
append
(
$
(
'<pre/>'
).
text
(
'Loading github.com/'
+
root
+
'/'
+
path
+
' ...'
)));
return
$
.
getJSON
(
'https://api.github.com/repos/'
+
root
+
'/contents/'
+
path
,
cb
);
return
$
.
getJSON
(
'https://api.github.com/repos/'
+
root
+
'/contents/'
+
path
)
.
done
(
function
(
data
)
{
if
(
'content'
in
data
)
{
cb
(
null
,
Base64
.
decode
(
data
.
content
));
}
else
{
cb
(
'Content not received'
);
}
})
.
fail
(
function
(
xhr
,
text
,
err
)
{
cb
(
err
);
});
}
}
var
executionContext
=
new
ExecutionContext
();
var
executionContext
=
new
ExecutionContext
();
...
...
src/app/compiler.js
View file @
a591fd20
...
@@ -3,8 +3,6 @@ var solc = require('solc/wrapper');
...
@@ -3,8 +3,6 @@ var solc = require('solc/wrapper');
var
webworkify
=
require
(
'webworkify'
);
var
webworkify
=
require
(
'webworkify'
);
var
utils
=
require
(
'./utils'
);
var
utils
=
require
(
'./utils'
);
var
Base64
=
require
(
'js-base64'
).
Base64
;
var
EventManager
=
require
(
'../lib/eventManager'
);
var
EventManager
=
require
(
'../lib/eventManager'
);
/*
/*
...
@@ -237,17 +235,16 @@ function Compiler (editor, handleGithubCall) {
...
@@ -237,17 +235,16 @@ function Compiler (editor, handleGithubCall) {
files
[
m
]
=
cachedRemoteFiles
[
m
];
files
[
m
]
=
cachedRemoteFiles
[
m
];
reloop
=
true
;
reloop
=
true
;
}
else
if
((
githubMatch
=
/^
(
https
?
:
\/\/)?(
www.
)?
github.com
\/([^\/]
*
\/[^\/]
*
)\/(
.*
)
/
.
exec
(
m
)))
{
}
else
if
((
githubMatch
=
/^
(
https
?
:
\/\/)?(
www.
)?
github.com
\/([^\/]
*
\/[^\/]
*
)\/(
.*
)
/
.
exec
(
m
)))
{
handleGithubCall
(
githubMatch
[
3
],
githubMatch
[
4
],
function
(
result
)
{
handleGithubCall
(
githubMatch
[
3
],
githubMatch
[
4
],
function
(
err
,
content
)
{
if
(
'content'
in
result
)
{
if
(
err
)
{
var
content
=
Base64
.
decode
(
result
.
content
);
cb
(
null
,
'Unable to import "'
+
m
+
'": '
+
err
);
cachedRemoteFiles
[
m
]
=
content
;
return
;
files
[
m
]
=
content
;
gatherImports
(
files
,
importHints
,
cb
);
}
else
{
cb
(
null
,
'Unable to import "'
+
m
+
'"'
);
}
}
}).
fail
(
function
()
{
cb
(
null
,
'Unable to import "'
+
m
+
'"'
);
cachedRemoteFiles
[
m
]
=
content
;
files
[
m
]
=
content
;
gatherImports
(
files
,
importHints
,
cb
);
});
});
return
;
return
;
}
else
if
(
/^
[^
:
]
*:
\/\/
/
.
exec
(
m
))
{
}
else
if
(
/^
[^
:
]
*:
\/\/
/
.
exec
(
m
))
{
...
...
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