Custom captureException() Line and File

Is there a way to customize the Error file and line / column number for errors sent to Sentry with Raven? I’ve tried creating and sending custom errors, but it seems like it gathers it’s error info from elsewhere. For context, I’m trying to send an error captured through an Adobe ExtendScript JSX file and forward that back into JS space so I can send the error to Sentry, however I want it to still show the line number and file name from the JSX file from where it started.

Here’s what I’ve tried:

			var err = new Error();
			err.message = 'testMessage';
			err.lineNumber = 55000;
			err.fileName = 'test.jsx';
			Raven.captureException(err);

However when the error reaches Sentry, it defines line number as the line I created the new Error() on, and filename as the file I’m sending my error from. Anyone ran into this before?

Thanks,
Justin

I have! I wanted to create my own errors and I saw this problem. However, I think this expected results for Error.

If I had a custom Error class:

CustomError= (function Custom_Error(message, file, line) {
	Error.call(this, message, file, line);
	
	//This seems to be needed still. I'm guessing the Error constructor doesn't set this directly for some reason.
	this.message = message;

	//Allows the calling code to set the line
	if(line) {
		this.line = line;
	}
	
	//Allows the calling code to set the file
	if(file) {
		this.file = file;
	}

	return this;
});

CustomError.prototype = new Error;
CustomError.prototype.constructor = Custom_Error;

I needed to throw the Error with the following:

throw new CustomError('message', new File($.fileName), $.line);

By the way, which library did you use to send exceptions to Sentry?
This one? https://www.npmjs.com/package/raven-js
Any chance you could share your setup code to get it connect?