onerror

Chrome truncates error messages and adds “<omitted>” in window.onerror

こ雲淡風輕ζ 提交于 2019-12-04 09:23:05
问题 We use window.onerror to catch unhandled exceptions (to log them for the dev team, and display a friendly user alert). Recently we noticed that in Google Chrome, the error message got truncated if it was above a certain length, and the text " ...<omitted>... " was mysteriously added to the error message. The code below will demonstrate this (in Chrome ver 33.0.1750). I was wondering if anyone else has had this problem? <html> <head> <script type="text/javascript"> window.onerror = function

How to handle different kinds of errors in Retrofit Rx onError without ugly instanceof

拈花ヽ惹草 提交于 2019-12-04 08:42:32
问题 I would like to know your ways to handle different kinds of errors (like http exceptions, no internet connection exceptions etc) in retrofit Rx onError without using instanceof like it's proposed here: How to handle network errors in Retrofit 2 with RxJava or here: Handle errors in Retrofit 2 RX In kotlin I will simply make some extension functions for each kind of throwable to do whatever I want. But I am forced to use Java in the project. Any nice suggestions? is the approach to build some

CSS or Javascript - display fallback text if background image not loaded [duplicate]

半腔热情 提交于 2019-12-04 06:53:12
问题 This question already has answers here : CSS background image alt attribute (10 answers) Closed 3 years ago . How can I display text instead of logo, if the logo graphic file isn't loaded or missing? I have div with background PNG image: <div class="iHaveBgImage"> this text should be displayed if bg image is not loaded </div> .iHaveBgImage { background-image: url('img.png') } It doesn't have to be pure CSS, Javascript solution is allowed. I was thinking of onerror event, but it works with

SSIS: Default Logging OnError don't work with RetainSameConnection

纵然是瞬间 提交于 2019-12-04 06:18:21
问题 I'm using RetainSameConnection=true with my Connection Manager since I'm using transactions (BEGIN TRANSACTION, COMMIT or ROLLBACK in the end if success/failure). I'm also using the default SQL Server Logging Provider and selected the OnError event (and others too). The problem is I can't see the OnError event logged in the sysssislog table (the table exists and the default insertion SP is created) - I can see other type of events logged. With the SQL profiler, I can check that the sp_ssis

Chrome truncates error messages and adds “<omitted>” in window.onerror

China☆狼群 提交于 2019-12-03 01:57:55
We use window.onerror to catch unhandled exceptions (to log them for the dev team, and display a friendly user alert). Recently we noticed that in Google Chrome, the error message got truncated if it was above a certain length, and the text " ...<omitted>... " was mysteriously added to the error message. The code below will demonstrate this (in Chrome ver 33.0.1750). I was wondering if anyone else has had this problem? <html> <head> <script type="text/javascript"> window.onerror = function (errorMsg, url, lineNumber) { alert('Error: ' + errorMsg); } var throwError = function () { throw new

CSS or Javascript - display fallback text if background image not loaded [duplicate]

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 13:07:32
This question already has an answer here: CSS background image alt attribute 10 answers How can I display text instead of logo, if the logo graphic file isn't loaded or missing? I have div with background PNG image: <div class="iHaveBgImage"> this text should be displayed if bg image is not loaded </div> .iHaveBgImage { background-image: url('img.png') } It doesn't have to be pure CSS, Javascript solution is allowed. I was thinking of onerror event, but it works with images, not elements that have image backgrounds. EDIT: I was told this has been answered before, but there is another situation

Image onError Handling in React

懵懂的女人 提交于 2019-12-02 10:11:22
问题 I am trying to grab the maxresdefault of multiple YouTube thumbnails. Some YouTube videos simply don't have a high res thumbnail photo so I want to catch that with an onError prop on an img element. For some reason my function is not triggering when I get the 404 img error. Any ideas? Thanks in advance. class FeaturedVideo extends Component<Props> { addDefaultSrc = (e) => { e.target.src = this.props.background.replace("maxresdefault", "hqdefault") } renderVideo = (props) => ( <div style={{

SSIS: Default Logging OnError don't work with RetainSameConnection

落爺英雄遲暮 提交于 2019-12-02 08:19:42
I'm using RetainSameConnection=true with my Connection Manager since I'm using transactions (BEGIN TRANSACTION, COMMIT or ROLLBACK in the end if success/failure). I'm also using the default SQL Server Logging Provider and selected the OnError event (and others too). The problem is I can't see the OnError event logged in the sysssislog table (the table exists and the default insertion SP is created) - I can see other type of events logged. With the SQL profiler, I can check that the sp_ssis_addlogentry was executed: exec sp_executesql N'exec sp_ssis_addlogentry @P1, @P2, @P3, @P4, @P5, @P6, @P7

Image onError Handling in React

南笙酒味 提交于 2019-12-02 05:18:51
I am trying to grab the maxresdefault of multiple YouTube thumbnails. Some YouTube videos simply don't have a high res thumbnail photo so I want to catch that with an onError prop on an img element. For some reason my function is not triggering when I get the 404 img error. Any ideas? Thanks in advance. class FeaturedVideo extends Component<Props> { addDefaultSrc = (e) => { e.target.src = this.props.background.replace("maxresdefault", "hqdefault") } renderVideo = (props) => ( <div style={{ width: "100%", height: "100%", backgroundSize: "contain", }} className="featured-community-video" > <img

javascript: onload and onerror called together

折月煮酒 提交于 2019-11-30 23:06:24
I'm new to JavaScript and therefore confused for the variable scope... I'm trying to load an image, and replace it with another URL when it doesn't exist. I have to do it in pure JavaScript. Here I got 2 versions extremely alike, but they perform differently. The only thing in common is: they don't work. The 3rd version requires a refresh and doesn't work under IE. d is the object with number attribute, which has no problem. Here is what they have in common .attr("xlink:href", function (d) { var img = new Image(); Here the Version 1: Both onload and onerror are called. However d receives the