MathJax - Math Process Error while adding equation - math

I'm using wiris editor to insert MathML, the MathML equation is as shown in the attached image.
When the MathML is processed by MathJax, the following error is occuring
When a callback is define at "Math Processing Error"
MathJax.Hub.Register.MessageHook("Math Processing Error",function (message) {
console.log(message[2].stack); // message[2] is the error object
});
It throws an exception saying
TypeError: Cannot read property 'firstChild' of null
at MathJax.Hub.Register.StartupHook.h.mo.Augment.CHTMLstretchV (TeX-AMS-MML_HTMLorMML.js?rev=2.5.3:62)

Related

Meteor publication send custom sanitized error to client in publication

I am not sure if I am just doing something wrong or if this is actually not working. I want to display the original publication error on the client, in case I catched one:
Meteor.publish('somePub', function (args) {
const self = this
try {
// ... publication logic
catch (pubErr) {
self.error(pubErr)
}
})
On the client I am "catching" this error via the onStop callback:
Meteor.subscribe('somePub', args, {
onStop: function (e) {
// display e to user
}
})
However, while on the server the pubErr is a Meteor.Error and according to the documentation it should be sent to the client, the client just receives a generic sanitized error message:
on the server
{
stack: "useful stack of actual method calls",
error: "somePub.failed",
reason: "somePub.invalidArguments",
details: { arg: undefined }
}
on the client
{
stack: "long list of ddp-message calls",
isClientSafe: true,
error: 500,
reason: "Internal server error",
details: undefined,
message: "Internal server error [500]",
errorType: "Meteor.Error"
}
Note: I also tried to add the error to itself as sanitizedError field, as in the documentation mentioned, but no success either.
Am I missing something here?
Actually I found the answer to the issue after being pointed into the right direction.
The example code works fine on a new project, so I checked why not in my project and I found, that I did not surround the arguments validation using SimpleSchema by the try/catch (unfortunately my question was poorly designed as it missed this important fact, mainly because I abstracted away the schema validation from the publication creation):
Meteor.publish('somePub', function (args) {
pubSchema.validate(args) // throws on fail
const self = this
try {
// ... publication logic
catch (pubErr) {
self.error(pubErr)
}
})
So I thought this could not be the issue's source but here is the thing: Simple Schema is not a pure Meteor package but a NPM package and won't throw a Meteor.Error but a custom instance of Error, that actually has the same attributes (error, errorType, details) like a Meteor.Error, see this part of the source code of a validation context.
So in order to pass the correct information of a SimpleSchema validation error to the client you should
wrap it in a try/catch
add the isClientSafe flag to it
alternatively convert it to a Meteor.Error
Attach a custom Meteor.Error as sanitizedError property to it

got this error : An unknown server-side error occurred while processing the command. Original error: Cannot read property 'replace' of undefined

Entered the desired capabilities from appium desktop and started the seesion and got this error : "An unknown server-side error occurred while processing the command. Original error: Cannot read property 'replace' of undefined"
On SetUp should be ("platformName", "iOS")
public void StartDriver()
{
DesiredCapabilities cap = new DesiredCapabilities();
cap.SetCapability("platformName", "iOS");
cap.SetCapability("deviceName", "iPhone Xr");
cap.SetCapability("automationName", "XCUITest");
cap.SetCapability("app","YourApp.app");
cap.SetCapability("autoAcceptAlerts", true);
driver = new IOSDriver<IWebElement>(new Uri("http://127.0.0.1:4723/wd/hub"), cap, TimeSpan.FromSeconds(300));
Assert.IsNotNull(driver.Context);
}
It would be better if you could provide more information about your error, but guessing from the error text, this is caused when you do not provide platformName capability.

HTTP.call throws errors instead of returning response

I am working with the Facebook graph API and have run into trouble regarding handling failed requests.
I use this code to create a new post
SocialFacebook.createPosting = function(data) {
var options = {
params: {
access_token : data.tokens.accessToken,
message : data.text
}
};
var url = 'https://graph.facebook.com/' + data.graphId + '/feed';
var response = HTTP.call('POST', url, options).data;
return response;
}
But instead of returning a JS object with error information in the response, it throws an error on failed requests
Exception while invoking method 'createPosting' Error: failed [500] {"error":{"message":"Duplicate status message","type":"FacebookApiException","code":506,"error_subcode":1455006,"is_transient":false,"error_user_title":"Duplicate Status Update","error_user_msg":"This status update is identical to the last one you posted. Try posting something different, or delete your previous update."}}
Because it's wrapped in an Error, the otherwise JSON object is now a string with some other stuff appended to it, which makes it difficult to parse and extract the attributes
Any idea as to why it throws an error, instead of returning a JS object with error details like usually?
Much appreciated
According to the docs, about HTTP.call():
On the server, this function can be run either synchronously or asynchronously. If the callback is omitted, it runs synchronously and the results are returned once the request completes successfully. If the request was not successful, an error is thrown.
So there you have it: since you called HTTP.call() synchronously (without providing a callback), if it responds with an error (in your case, Code 500) the error is thrown and not included in the data.

Stopping an R script without getting "Error during wrapup" message

I wrote an R script which writes messages (progress report) to a text file. I modified the error option so that when an error occurs, the error message is also written to that file:
options(error = function() {
cat(geterrmessage(),file = normalizePath("logs/messages.txt"),append = TRUE)
stop()
})
It works, but I get this message in the console/terminal window when an error does occur:
Error during wrapup:
Execution halted
So I'm thinking there's a better way to interrupt the execution of the script... or is there?
I just found this inside R source code:
if (inError) {
/* fail-safe handler for recursive errors */
if(inError == 3) {
/* Can REprintf generate an error? If so we should guard for it */
REprintf(_("Error during wrapup: "));
/* this does NOT try to print the call since that could
cause a cascade of error calls */
Rvsnprintf(errbuf, sizeof(errbuf), format, ap);
REprintf("%s\n", errbuf);
}
stop() causes the error handler to be executed. If the stop() call occurs within the error handler, R displays the Error during wrapup: message and prevents you from the infinite recursion that would occur otherwise.
Do not call stop() from inside your options$error.
Use q(save="no", status=1, runLast=FALSE) instead, that should do exactly what the default error handler does for non-interactive use. See ?options for the meaning of options$error and ?stop for details about error handling.

Meteor domutils error

I have a meteor application that starts to be quite large. I have still quite important problems to debug my application for exemple I have a error :
Uncaught TypeError: Cannot read property 'nodeType' of null domutils.js?52c3c7ff9e0acd52ac427a8f103760e222ba2722:295
Uncaught TypeError: Cannot read property '_spark_bY6hxpJRdJcb2nynQ' of null
I cannot find the source of the error.
I was having the same problem. For me it occurred when I clicked a link which caused a new template to load. When I added:
event.stopImmediatePropagation();
as shown below, the error was corrected.
Template.define_blocks.events({
'click #tb_yes': function(event) {
event.preventDefault();
event.stopImmediatePropagation();
});

Resources