brokepoint 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1a9c0b3a99be5d37094f6131690e805054679149c65b89f44f6569c57d304d2
4
- data.tar.gz: f1019a9f0dc8a686816671e65a1815b446281e7d509840e97fa67c77412007ad
3
+ metadata.gz: 2c05ef2ca808c3809c2585fc3cda62ce3392a3f03c2a5218995deac5ad870211
4
+ data.tar.gz: 146b934a814e83e11e19d5d1b7eed2145a127e58ac3af333ea758c42f06dc3ec
5
5
  SHA512:
6
- metadata.gz: 200e448f4245b71f40e187c4c98f095d88a8152bec4a6d04c8a0fcce96c7ace41348ce91f9874e2c4b7687c8c6ef143d945eee58b967f6ebf0b4d6d565e124e1
7
- data.tar.gz: 847797b0d789df43993398994422653b5653c681eca0dc9db0fea5a5806a3762e357e938d66b6681efa7abae268143eade4dd2b02fa8d8380ebb41b5688c2534
6
+ metadata.gz: f3c440626beeff27ebf18e76c05f38301c6dbc68a44425d4707c03a04c3ce270946e2e2637abe137e290dad31572edfb44aa52a9004ce9289e79a9e41a9ca6c9
7
+ data.tar.gz: 95a93be172d490db38196e8e2fc1c990b493142eb7808dd9b00ec5597cc8389366c5b521bb4d81b58292c8181b3b6db0a691310c64311b68bc02f9d02da999e1
data/brokepoint.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
6
6
  s.summary = "Use this gem to capture errors, exceptions, and logs and send them to your Brokepoint install"
7
7
  s.authors = ["Shane P"]
8
8
  s.email = 'shane@shane.computer'
9
- s.files = Dir['lib/**/*.rb', '*.gemspec']
9
+ s.files = Dir['lib/**/*.rb', '*.gemspec', 'javascript/**/*.js']
10
10
  s.homepage = 'https://rubygems.org/gems/brokepoint'
11
11
  s.platform = Gem::Platform::RUBY
12
12
  s.license = nil
@@ -0,0 +1,47 @@
1
+ class Brokepoint {
2
+ recordError(error) {
3
+ let errorPayload = {
4
+ language: 'javascript',
5
+ url: window.location.toString(),
6
+ url_method: 'GET'
7
+ };
8
+
9
+ errorPayload['name'] = error.message;
10
+ errorPayload['raw_body'] = `${error.source}:${error.lineno}`;
11
+
12
+ if (error instanceof PromiseRejectionEvent) {
13
+ errorPayload['name'] = error.reason.code;
14
+ errorPayload['raw_body'] = 'no stacktrace support for promises yet';
15
+ }
16
+
17
+ if (errorPayload['name'] === undefined || errorPayload['raw_body'] === undefined) {
18
+ console.log("Couldn't get enough details about error", error, errorPayload);
19
+ }
20
+
21
+ this.notify(errorPayload);
22
+ }
23
+
24
+ notify(error) {
25
+ fetch(
26
+ this.endpoint,
27
+ {
28
+ method: 'POST',
29
+ body: JSON.stringify({ event: error }),
30
+ headers: {
31
+ "Content-Type": "application/json",
32
+ },
33
+ }
34
+ )
35
+ }
36
+
37
+ init() {
38
+ window.addEventListener("unhandledrejection", (event) => this.recordError(event));
39
+
40
+ window.onerror = (message, source, lineno, colno, error) => { this.recordError({ message, source, lineno, colno, error }) }
41
+ }
42
+ }
43
+
44
+ const brokepoint = new Brokepoint();
45
+ brokepoint.init();
46
+
47
+ window.brokepoint = brokepoint;
@@ -1,3 +1,3 @@
1
1
  module Brokepoint
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brokepoint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane P
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-08-28 00:00:00.000000000 Z
10
+ date: 2025-09-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: zeitwerk
@@ -43,6 +43,7 @@ extensions: []
43
43
  extra_rdoc_files: []
44
44
  files:
45
45
  - brokepoint.gemspec
46
+ - javascript/load_brokepoint.js
46
47
  - lib/brokepoint.rb
47
48
  - lib/brokepoint/middleware.rb
48
49
  - lib/brokepoint/notifier.rb