Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Toolkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
digital blueprint
Web Component Framework
Toolkit
Merge requests
!160
Remove sentry integration
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Closed
Remove sentry integration
remove-sentry
into
master
Overview
0
Commits
1
Pipelines
1
Changes
3
Closed
Remove sentry integration
Reiter, Christoph
requested to merge
remove-sentry
into
master
Apr 5, 2022
Overview
0
Commits
1
Pipelines
1
Changes
3
We never used it besides in experiments, so drop it.
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
d32309bc
1 commit,
Apr 5, 2022
3 files
+
1
−
150
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
packages/common/errorreport.js deleted
100644 → 0
+
0
−
96
View file @ fbcf305c
import
*
as
Sentry
from
'
@sentry/browser
'
;
let
_isInitialized
=
false
;
let
_canReportEvent
=
false
;
let
sentryDSN
=
''
;
/**
* Initializes error reporting.
*
* If a sentry DSN is set we will use sentry, if not we will log to the console.
*
* @param {object} [options]
* @param {boolean} [options.debug=false] Enable debug output
* @param {string} [options.release] The project release
*/
export
function
init
(
options
)
{
let
defaults
=
{
debug
:
false
,
};
let
actual
=
Object
.
assign
({},
defaults
,
options
);
if
(
_isInitialized
)
throw
new
Error
(
'
Already initialized
'
);
let
sentryOptions
=
{
debug
:
actual
.
debug
};
if
(
actual
.
release
)
{
sentryOptions
[
'
release
'
]
=
actual
.
release
;
}
if
(
actual
.
environment
)
{
sentryOptions
[
'
environment
'
]
=
actual
.
environment
;
}
if
(
!
sentryDSN
)
{
if
(
options
.
debug
)
console
.
log
(
'
No sentry DSN set, sentry disabled
'
);
// In case we don't have a sentry config, we still use sentry, but print
// all events into the console don't send them to the server.
// XXX: Dummy DSN needed to make init() work.
sentryOptions
[
'
dsn
'
]
=
'
http://12345@dummy.dummy/42
'
;
sentryOptions
[
'
beforeSend
'
]
=
(
event
,
hint
)
=>
{
console
.
error
(
'
ERR-REPORT:
'
,
hint
.
originalException
||
hint
.
syntheticException
);
return
null
;
};
}
else
{
sentryOptions
[
'
dsn
'
]
=
sentryDSN
;
_canReportEvent
=
true
;
}
Sentry
.
init
(
sentryOptions
);
_isInitialized
=
true
;
}
/**
* Whether showReportDialog() will work.
*/
export
function
canReportEvent
()
{
if
(
!
_isInitialized
)
throw
new
Error
(
'
Not initialized
'
);
return
_canReportEvent
;
}
/**
* Show a report dialog for user error feedback.
*
* Call canReportEvent() first to see if this will do anything.
*/
export
function
showReportDialog
()
{
if
(
!
canReportEvent
())
return
;
Sentry
.
showReportDialog
();
}
/**
* Log an exception
*
* @param {*} exception
*/
export
function
captureException
(
exception
)
{
if
(
!
_isInitialized
)
throw
new
Error
(
'
Not initialized
'
);
Sentry
.
captureException
(
exception
);
}
/**
* Log a message, returns an internal ID
*
* @param {string} message The message to log
* @param {string} [level=error] The loglevel (error, warning, info, debug)
*/
export
function
captureMessage
(
message
,
level
)
{
if
(
!
_isInitialized
)
throw
new
Error
(
'
Not initialized
'
);
if
(
!
level
)
level
=
'
error
'
;
if
(
!
[
'
error
'
,
'
warning
'
,
'
info
'
,
'
debug
'
].
includes
(
level
))
throw
new
Error
(
'
Invalid log level
'
);
Sentry
.
captureMessage
(
message
,
level
);
}
Loading