这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@scamden
Copy link

@scamden scamden commented Jan 14, 2016

@eriwen
Copy link
Member

eriwen commented Jan 15, 2016

Thanks! Would it be possible to add a test for createGlobalGPSInstance?

@scamden
Copy link
Author

scamden commented Jan 15, 2016

Sure, I guess just test that a n instance of GPS ends up on the stack trace
object?
Sterling Camden

Sent from RelateIQ

On January 15, 2016 at 7:52 AMEric Wendelinnotifications@github.com wrote:

Thanks! Would it be possible to add a test for createGlobalGPSInstance?


Reply to this email directly or view it on GitHub
#150 (comment)
.

@eriwen
Copy link
Member

eriwen commented Jan 16, 2016

Actually, what might be a more consistent approach would be to allow the user to pass in a StackTraceGPS instance, just like is done here: https://github.com/stacktracejs/stacktrace-gps/blob/master/stacktrace-gps.js#L153

Should be easy to write a test. Here's a sample: https://github.com/stacktracejs/stacktrace-gps/blob/master/spec/stacktrace-gps-spec.js#L209

@scamden
Copy link
Author

scamden commented Jan 16, 2016

The only reason I didn't take that approach is that the user never actually
calls new on the main stack trace module like they do with GPS; it's called
as a factory by the library and I wanted to make sure the gps instance
would be intentionally cached for all usages not just calls to fromError
externally if that makes sense. Happy to try another approach though if you
have an idea there.
Sterling Camden

Sent from RelateIQ

On January 15, 2016 at 7:02 PMEric Wendelinnotifications@github.com wrote:

Actually, what might be a more consistent approach would be to allow the
user to pass in a StackTraceGPS instance, just like is done here:
https://github.com/stacktracejs/stacktrace-gps/blob/master/stacktrace-gps.js#L153

Should be easy to write a test. Here's a sample:
https://github.com/stacktracejs/stacktrace-gps/blob/master/spec/stacktrace-gps-spec.js#L209


Reply to this email directly or view it on GitHub
#150 (comment)
.

stacktrace.js Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: whitespace here

@eriwen
Copy link
Member

eriwen commented Jan 16, 2016

You make good points about avoiding the need to keep track of StackTrace and a separate GPS instance.

If one can just call this.gps = new StackTraceGPS(opts) and then have that persisted, why wouldn't we do that by default instead of requiring that a user call createGlobalGPSInstance()? I fear that this.gps might be lost and we're back to square one, but I could be wrong.

@scamden
Copy link
Author

scamden commented Jan 18, 2016

so i thought about allowing this.gps = new StackTraceGPS(opts), but i used the method instead to maintain encapsulation. Like the user shouldn't need to know the name of the internal field we're going to use. that said, it's a very simple use case and i don't feel strongly.

@scamden
Copy link
Author

scamden commented Jan 26, 2016

closing in favor of using the opts.sourceCache

@scamden scamden closed this Jan 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants