Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8db973db
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8db973db
编写于
7月 30, 2019
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adopt latest loader (throws Error objects)
上级
60684fba
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
45 addition
and
26 deletion
+45
-26
src/vs/loader.js
src/vs/loader.js
+29
-24
src/vs/workbench/browser/workbench.ts
src/vs/workbench/browser/workbench.ts
+16
-2
未找到文件。
src/vs/loader.js
浏览文件 @
8db973db
...
...
@@ -235,6 +235,17 @@ var AMDLoader;
*--------------------------------------------------------------------------------------------*/
var
AMDLoader
;
(
function
(
AMDLoader
)
{
function
ensureError
(
err
)
{
if
(
err
instanceof
Error
)
{
return
err
;
}
var
result
=
new
Error
(
err
.
message
||
String
(
err
)
||
'
Unknown Error
'
);
if
(
err
.
stack
)
{
result
.
stack
=
err
.
stack
;
}
return
result
;
}
AMDLoader
.
ensureError
=
ensureError
;
;
var
ConfigurationOptionsUtil
=
/** @class */
(
function
()
{
function
ConfigurationOptionsUtil
()
{
...
...
@@ -244,22 +255,16 @@ var AMDLoader;
*/
ConfigurationOptionsUtil
.
validateConfigurationOptions
=
function
(
options
)
{
function
defaultOnError
(
err
)
{
if
(
err
.
errorCode
===
'
load
'
)
{
if
(
err
.
phase
===
'
loading
'
)
{
console
.
error
(
'
Loading "
'
+
err
.
moduleId
+
'
" failed
'
);
console
.
error
(
'
Detail:
'
,
err
.
detail
);
if
(
err
.
detail
&&
err
.
detail
.
stack
)
{
console
.
error
(
err
.
detail
.
stack
);
}
console
.
error
(
err
);
console
.
error
(
'
Here are the modules that depend on it:
'
);
console
.
error
(
err
.
neededBy
);
return
;
}
if
(
err
.
errorCod
e
===
'
factory
'
)
{
if
(
err
.
phas
e
===
'
factory
'
)
{
console
.
error
(
'
The factory method of "
'
+
err
.
moduleId
+
'
" has thrown an exception
'
);
console
.
error
(
err
.
detail
);
if
(
err
.
detail
&&
err
.
detail
.
stack
)
{
console
.
error
(
err
.
detail
.
stack
);
}
console
.
error
(
err
);
return
;
}
}
...
...
@@ -302,7 +307,7 @@ var AMDLoader;
if
(
!
Array
.
isArray
(
options
.
nodeModules
))
{
options
.
nodeModules
=
[];
}
if
(
typeof
options
.
nodeCachedData
===
'
object
'
)
{
if
(
options
.
nodeCachedData
&&
typeof
options
.
nodeCachedData
===
'
object
'
)
{
if
(
typeof
options
.
nodeCachedData
.
seed
!==
'
string
'
)
{
options
.
nodeCachedData
.
seed
=
'
seed
'
;
}
...
...
@@ -310,7 +315,9 @@ var AMDLoader;
options
.
nodeCachedData
.
writeDelay
=
1000
*
7
;
}
if
(
!
options
.
nodeCachedData
.
path
||
typeof
options
.
nodeCachedData
.
path
!==
'
string
'
)
{
options
.
onError
(
'
INVALID cached data configuration,
\'
path
\'
MUST be set
'
);
var
err
=
ensureError
(
new
Error
(
'
INVALID cached data configuration,
\'
path
\'
MUST be set
'
));
err
.
phase
=
'
configuration
'
;
options
.
onError
(
err
);
options
.
nodeCachedData
=
undefined
;
}
}
...
...
@@ -1007,11 +1014,10 @@ var AMDLoader;
}
}
if
(
producedError
)
{
config
.
onError
({
errorCode
:
'
factory
'
,
moduleId
:
this
.
strId
,
detail
:
producedError
});
var
err
=
AMDLoader
.
ensureError
(
producedError
);
err
.
phase
=
'
factory
'
;
err
.
moduleId
=
this
.
strId
;
config
.
onError
(
err
);
}
this
.
dependencies
=
null
;
this
.
_callback
=
null
;
...
...
@@ -1301,16 +1307,15 @@ var AMDLoader;
this
.
defineModule
(
this
.
_moduleIdProvider
.
getStrModuleId
(
moduleId
),
defineCall
.
dependencies
,
defineCall
.
callback
,
null
,
defineCall
.
stack
);
}
};
ModuleManager
.
prototype
.
_createLoadError
=
function
(
moduleId
,
err
)
{
ModuleManager
.
prototype
.
_createLoadError
=
function
(
moduleId
,
_
err
)
{
var
_this
=
this
;
var
strModuleId
=
this
.
_moduleIdProvider
.
getStrModuleId
(
moduleId
);
var
neededBy
=
(
this
.
_inverseDependencies2
[
moduleId
]
||
[]).
map
(
function
(
intModuleId
)
{
return
_this
.
_moduleIdProvider
.
getStrModuleId
(
intModuleId
);
});
return
{
errorCode
:
'
load
'
,
moduleId
:
strModuleId
,
neededBy
:
neededBy
,
detail
:
err
};
var
err
=
AMDLoader
.
ensureError
(
_err
);
err
.
phase
=
'
loading
'
;
err
.
moduleId
=
strModuleId
;
err
.
neededBy
=
neededBy
;
return
err
;
};
/**
* Callback from the scriptLoader when a module hasn't been loaded.
...
...
src/vs/workbench/browser/workbench.ts
浏览文件 @
8db973db
...
...
@@ -79,11 +79,25 @@ export class Workbench extends Layout {
setUnexpectedErrorHandler
(
error
=>
this
.
handleUnexpectedError
(
error
,
logService
));
// Inform user about loading issues from the loader
interface
AnnotatedLoadingError
extends
Error
{
phase
:
'
loading
'
;
moduleId
:
string
;
neededBy
:
string
[];
}
interface
AnnotatedFactoryError
extends
Error
{
phase
:
'
factory
'
;
moduleId
:
string
;
}
interface
AnnotatedValidationError
extends
Error
{
phase
:
'
configuration
'
;
}
type
AnnotatedError
=
AnnotatedLoadingError
|
AnnotatedFactoryError
|
AnnotatedValidationError
;
(
<
any
>
window
).
require
.
config
({
onError
:
(
err
:
{
errorCode
:
string
;
}
)
=>
{
if
(
err
.
errorCode
===
'
load
'
)
{
onError
:
(
err
:
AnnotatedError
)
=>
{
if
(
err
.
phase
===
'
loading
'
)
{
onUnexpectedError
(
new
Error
(
localize
(
'
loaderErrorNative
'
,
"
Failed to load a required file. Please restart the application to try again. Details: {0}
"
,
JSON
.
stringify
(
err
))));
}
console
.
error
(
err
);
}
});
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录