Skillbar not loading Error message: Cannot read property 'top' of undefined - animate.css

I am trying to animate a 'Skillbar' using HTML, CSS, JS, and animate.css. I am getting the error:
Error feedback: Uncaught TypeError: Cannot read property 'top' of undefined.
I am using a grid system rather than bootstrap
var skillBarTopPos = jQuery('.skillbar').position().top;
jQuery(document).scroll(function(){
var scrolled_val = $(document).scrollTop().valueOf();
if(scrolled_val>skillBarTopPos-250)
startAnimation();
});
function startAnimation(){
jQuery('.skillbar').each(function(){
jQuery(this).find('.skillbar-bar').animate({
width:jQuery(this).attr('data-percent')
},6000);
});
};

Related

How to detect "Uncaught (in promise) TypeError" in Playwright?

I'm using Playwright to test my TypeScript webapp, and I want to ensure no errors are logged to the console. (I want my tests to fail if an error occurs.)
To do so, based on this post, I use the following code:
import { test as base, expect } from '#playwright/test';
export const test = base.extend({
page: async ({ baseURL, page }, use) => {
const messages: string[] = [];
page.on('console', (msg) => {
// Ignore regular log messages; we are only interested in errors.
if (msg.type() === 'error') {
messages.push(`[${msg.type()}] ${msg.text()}`);
}
});
await use(page);
expect(messages).toStrictEqual([]);
},
});
export default test;
This code will correctly cause the test to fail if console.error is used in the app.
However, Uncaught (in promise) TypeError is ignored by this check; the test completes successfully even though the following message is logged to the console:
ion-refresher.js:526 Uncaught (in promise) TypeError: ee.componentOnReady is not a function
at _class._callee8$ (ion-refresher.js:526:21)
at tryCatch (regeneratorRuntime.js:86:17)
at Generator._invoke (regeneratorRuntime.js:66:24)
at Generator.next (regeneratorRuntime.js:117:21)
at asyncGeneratorStep (asyncToGenerator.js:3:20)
at _next (asyncToGenerator.js:25:9)
at asyncToGenerator.js:32:7
at new Promise (<anonymous>)
at _class.<anonymous> (asyncToGenerator.js:21:12)
at _class.connectedCallback (ion-refresher.js:187:51)
I want to catch this kind of error (Uncaught (in promise) TypeError) automatically when running my Playwright tests because it should never occur. How can I do that?
(I tried removing the msg.type() === 'error' check from my code, but that didn't help-- Uncaught (in promise) TypeError do not show up as console errors in Playwright, so where are they?)
Based on the comment from #stefan judis, I was able to capture this error by checking for page errors in addition to console errors.
Here's the final code:
import { test as base, expect } from '#playwright/test';
export const test = base.extend({
page: async ({ baseURL, page }, use) => {
const messages: string[] = [];
page.on('console', (msg) => {
// Ignore regular log messages; we are only interested in errors.
if (msg.type() === 'error') {
messages.push(`[${msg.type()}] ${msg.text()}`);
}
});
// Uncaught (in promise) TypeError + friends are page errors.
page.on('pageerror', (error) => {
messages.push(`[${error.name}] ${error.message}`);
});
await use(page);
expect(messages).toStrictEqual([]);
},
});
export default test;

Cannot read property 'url' of undefined discord.js

I don't know what's wrong in my code, this error not appear everytimes, just sometimes and i don't know why i got this error
Here is the part of code where the error is detected :
const song = {
title: songInfo.videoDetails.title,
url: songInfo.videoDetails.video_url,
thumbnail: songInfo.videoDetails.thumbnails[4].url,
author: songInfo.videoDetails.author.name,
viewCount: songInfo.videoDetails.viewCount,
duration: songInfo.videoDetails.lengthSeconds,
agelimited: songInfo.videoDetails.age_restricted
};
With the const song, i cant get information of a Youtube video to send a message on discord like that :
const Embedaddqueue = new Discord.MessageEmbed()
.setColor('#008000')
.setTitle('Music added to the music queue!')
.setDescription(`**${song.title}** by **${song.author}**`)
.setURL(song.url)
.setImage(song.thumbnail)
return message.channel.send(Embedaddqueue);
But with some video, i get this error when i do "!play https://youtube.com/********" or "!play https://youtu.be/****"
TypeError: Cannot read property 'url' of undefined

ng-token-auth errors - preventing app from loading

I have an AngularJs + Ruby on Rails app and I'm trying to integrate ng-token-auth, however I am getting the following warning and errors when my app loads, preventing the app from actually loading:
jQuery.Deferred exception: Cannot read property 'validateOnPageLoad' of
undefined TypeError: Cannot read property 'validateOnPageLoad' of
undefined
-
TypeError: Cannot read property 'proxyIf' of undefined
at Object.apiUrl (ng-token-auth.self-50017ec….js?body=1:689)
at ng-token-auth.self-50017ec….js?body=1:789
at Object.invoke (angular.self-5592af5….js?body=1:4626)
at request (ng-token-auth.self-50017ec….js?body=1:786)
at processQueue (angular.self-5592af5….js?body=1:15758)
at angular.self-5592af5….js?body=1:15774
at Scope.$eval (angular.self-5592af5….js?body=1:17026)
at Scope.$digest (angular.self-5592af5….js?body=1:16842)
at angular.self-5592af5….js?body=1:17065
at completeOutstandingRequest (angular.self-5592af5….js?
body=1:5825)
-
TypeError: Cannot read property 'url' of undefined
at ng-token-auth.self-50017ec….js?body=1:815
at Object.invoke (angular.self-5592af5….js?body=1:4626)
at responseError (ng-token-auth.self-50017ec….js?body=1:813)
at processQueue (angular.self-5592af5….js?body=1:15758)
at angular.self-5592af5….js?body=1:15774
at Scope.$eval (angular.self-5592af5….js?body=1:17026)
at Scope.$digest (angular.self-5592af5….js?body=1:16842)
at angular.self-5592af5….js?body=1:17065
at completeOutstandingRequest (angular.self-5592af5….js?
body=1:5825)
at angular.self-5592af5….js?body=1:6101
-
Uncaught TypeError: Cannot read property 'validateOnPageLoad' of undefined
at Object.addScopeMethods (ng-token-auth.self-50017ec….js?
body=1:168)
at Object.initialize (ng-token-auth.self-50017ec….js?body=1:109)
at ng-token-auth.self-50017ec….js?body=1:836
at Object.invoke (angular.self-5592af5….js?body=1:4626)
at angular.self-5592af5….js?body=1:4434
at forEach (angular.self-5592af5….js?body=1:322)
at createInjector (angular.self-5592af5….js?body=1:4434)
at doBootstrap (angular.self-5592af5….js?body=1:1711)
at bootstrap (angular.self-5592af5….js?body=1:1732)
at angularInit (angular.self-5592af5….js?body=1:1617)
here's my app index and auth config:
(function(){
'use strict';
angular.module('MyApp', [
'restangular',
'ui.router',
'templates',
'ui.bootstrap',
'ng-token-auth'
]).config(authConfig);
authConfig.$inject = ['$authProvider'];
/** #ngInject */
function authConfig($authProvider) {
$authProvider.configure({
apiUrl: 'http://localhost:8000/'
});
}
})();
UPDATE
It seems that it either cannot find my config or getConfig does not exist:
addScopeMethods: function() {
return c.user = this.user,
c.authenticate = angular.bind(this, this.authenticate),
c.signOut = angular.bind(this, this.signOut),
c.destroyAccount = angular.bind(this, this.destroyAccount),
c.submitRegistration = angular.bind(this, this.submitRegistration),
c.submitLogin = angular.bind(this, this.submitLogin),
c.requestPasswordReset = angular.bind(this, this.requestPasswordReset),
c.updatePassword = angular.bind(this, this.updatePassword),
c.updateAccount = angular.bind(this, this.updateAccount),
this.getConfig().validateOnPageLoad ? this.validateUser({
config: this.getSavedConfig()
}) : void 0
},
It fails in the above code on this.getConfig().validateOnPageLoad because getConfig() is undefined. getSavedConfig() returns the expected config, however...
I'm using devise on the back end, so my understanding is that I just need a minimal config like this to get started.
Please let me know what other info I can provide!
I figured it out!
I changed my config to:
function authConfig($authProvider) {
$authProvider.configure([{
default: {
apiUrl: 'http://localhost:8000/'
},
user: {
apiUrl: 'http://localhost:8000/'
}
}]);
}
in getConfig e was undefined, so return t[this.getCurrentConfigName(e)] was returning 'user', but I had no config named 'user', so 'undefined' was returned. Adding a named config fixed this issue since t here is an object with keys that are the names of your config values.

Uncaught SyntaxError: Unexpected identifier in render method reactjs

I am using browserify rails and reactify and have the following component (pasted below). But, when I call it for rendering from a javascript file as shown in the second part below, I get the following error at the return line of the render method. Can you kindly help and let me know what is wrong?
Uncaught SyntaxError: Unexpected identifier error
Component:
/** #jsx React.DOM */
var React = require('react')
var Hello = React.createClass({
render: function() {
return <div>Hello, {this.props.name}</div>
}
})
Calling from JS file:
var React = require('react');
var HelloMessage = require('alacalc/test_react');

Bindings on ObjectController - Ember.js

When you try adding a binding to an ObjectController it doesn't work.
App.FailController = Em.ObjectController.extend({
content: null,
myBinding: "App.router.myController" // <-- fails
});
Error:
Uncaught Error: assertion failed: Cannot delegate set('my', ) to the 'content' property of object proxy <.FailController:ember154>: its 'content' is undefined.
It tries adding it to the content property.
jsFiddle: demo
credits: to caligo-mentis who answered this over at github.
ObjectProxy delegates any call to set to the content property unless a property with the same name exists on the ObjectProxy instance. The simple solution is to define a property with the desired name prior to declaring the binding.
App.FailController = Em.ObjectController.extend({
my: null,
myBinding: "App.router.myController" // <-- works
});
jsFiddle: demo
Alternative solution:
App.FailController = Em.ObjectController.extend({
content: Ember.Object.create(),
my: function() {
return App.router.myController;
}.property('App.router.myController')
});
or better:
App.FailController = Em.ObjectController.extend({
content: Ember.Object.create(),
my: Ember.computed.alias('App.router.myController')
});

Resources