async function loginEmailPassword(email, password) {
const credentials = Realm.Credentials.emailPassword(email, password);
try {
const user = await app.logIn(credentials);
console.assert(user.id === app.currentUser.id)
return user;
} catch(err) {
console.error("Failed to log in.", err);
}
}
This is from the Mongodb documentation but it just won't log the error nor an error code. Nothing.
I found this and one of the answers included this but I don't understand it.
Please can someone with more programming knowledge than me explain to me how I can get the error codes from Realm so that I can tell the user why login didn't work?
Thank you very much!
Edit:
I found out that the second of the error codes indeed is from the console.error command. Now I just need to extract the actual error message and code.
How can I turn the built in tokenat(text, index, separator) function into an actual Javascript function for the importForEvents.js scripts?
That's what I have so far:
function tokenat(text, index, separator) {
var result = text.substring(text.indexOf(separator) + 1);
return result;
}
But I'm too dumb to implement the index part for the case if there are multiple separators.