Search Results

Search found 13191 results on 528 pages for 'unhandled exception'.

Page 10/528 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Unresponsive Clojure REPL after exception

    - by Hendekagon
    If I start a REPL and then do something that throws an exception like (use 'non-existent-thing) ** then after that the REPL ceases to evaluate anything I enter. Is there a special key I can press to make it turn round, face me, uncross its arms and listen once more ? Or must I ctrl-d, restart, type everything up to where I was and get it right this time ? ** which results in: Exception in thread "Thread-1" java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate non_existent_thing__init.class or non_existent_thing.clj on classpath: (NO_SOURCE_FILE:0)

    Read the article

  • How to catch an exception and email information about it in liferay portlet

    - by heikkim
    I have a custom portlet made for liferay and sometimes it throws an exception. Why it throws exceptions is irrelevant. How to catch exceptions thrown by portlet handler methods in order to email information about them? I know I could do try catching on every handler method but it would be a much more elegant and cleaner solution to catch the exception on a higher level and just email some information about the error. I'm using Spring Portlet MVC, so i got all spring-related niceties at hand.

    Read the article

  • Check if Database raises a particular exception

    - by mcabral
    using Nhibernate; I'm trying to insert several values a on table which has an unique index on some columns. I'd like to know if a particular insert raises an exception for having violated the unique constraint. So, which particular exception type should i catch? I only want to catch this particular one and let all others go up. Thanks a lot!

    Read the article

  • C# Find out what column caused the Sql Exception

    - by PaN1C_Showt1Me
    Hi. I'm getting an exception from SQL Data Reader (MS SQL as datastore) and I'd like to know which column name causes this Exception to be thrown. But I cannot find it in the InnerException.. nowhere. ((System.InvalidOperationException)ex.InnerException).StackTrace: System.Data.SqlClient.SqlDataReader.ReadColumnHeader(Int32 i) System.Data.SqlClient.SqlDataReader.IsDBNull(Int32 i) ... Where is it hidden please ?

    Read the article

  • What happens if an exception is thrown in finalize()

    - by Psykocyber
    What would happen if an exception is thrown during the execution of finalize()? Is the stack unwind like normally? Does it continue finalize() and ignore the exception? Does it stop finalize() and continue GC the object? Or something else? I'm not looking for guidelines of using finalize() there are plently of pages explaining that.

    Read the article

  • How to get the name of the method that caused the exception

    - by SKumar
    My code looks as below. try { _productRepo.GetAllProductCategories(); } catch (Exception ex) { //Do Something } I need a way to show the method name, suppose in the above case if any exception is thrown in the GetAllProductCategories() method, I need to get this method name i.e. "GetAllProductCategories()" as my result. Can any one suggest me how to do this?

    Read the article

  • What happens if an exception is thrown during finalize()

    - by Psykocyber
    What would happen if an exception is thrown during the execution of finalize()? Is the stack unwind like normally? Does it continue finalize() and ignore the exception? Does it stop finalize() and continue GC the object? Or something else? I'm not looking for guidelines of using finalize() there are plently of pages explaining that.

    Read the article

  • show line in exception.message

    - by Crash893
    How would one display what line number caused the error and is this even possible with the way that .net compiles its exes? If not is there an automated way for exception.message to display the sub that crapped out? try { int x = textbox1.text; } catch(exception ex) { messagebox.show(ex.message); }

    Read the article

  • Catch clearly defined exception from sub.submodule in python

    - by mynthon
    I have 3 files. xxx which imports xxx2 and xxx2 imports xxx3 which one raises OppsError exception. xxx3.py: class OppsError(Exception):pass def go(): raise OppsError() xxx2.py: import xxx3 xxx3.go() xxx.py: try: import xxx2 except xxx3.OppsError: print 'ops' When i run xxx.py i get error NameError: name 'xxx3' is not defined. Is importing xxx3 inside xxx only way to catch OppsError?

    Read the article

  • is there a proper way to handle multiple errors/exceptions?

    - by toPeerOrNotToPeer
    in OO programming, is there some conceptual pattern, ideas, about handling multiple errors? for example, i have a method that performs some checks and should return an error message for each error found ['name is too short', 'name contains invalid unicode sequences', 'name is too long'] now, should i use an array of exceptions (not thrown exceptions)? or something like this is better: class MyExceptionList extends Exception{ public Void addException(Exception e){} public Array getExceptions(){} } any theory behind this argument will be appreciated! (this isn't a request about a specific programming language, but a pure theoretical one) thank you in advance

    Read the article

  • Throwing exception or retuning value

    - by user274737
    I am using another service in a Service Oriented Architecture. My service used the other service to save data into the database. Is is good practice for me to rethrow the exception which i get from save service or should i catch the exception and encapsulate it in my result and then just send the result back.

    Read the article

  • XAML Parsing Exception

    - by e28Makaveli
    I have a simple XAML page that load fine when it is loaded as part of any application within Visual Studio. However, when I deploy this application using ClickOnce, I get the following exception: Type : System.Windows.Markup.XamlParseException, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 Message : Unable to cast object of type 'System.Windows.Controls.Grid' to type 'EMS.Controls.Dictionary.StatusBarControl'. Error at object 'System.Windows.Controls.Grid' in markup file 'EMS.Controls.Dictionary;component/views/statusbarcontrol.xaml'. Source : PresentationFramework Help link : LineNumber : 0 LinePosition : 0 KeyContext : UidContext : NameContext : BaseUri : pack://application:,,,/EMS.Controls.Dictionary;component/views/statusbarcontrol.xaml Data : System.Collections.ListDictionaryInternal TargetSite : Void ThrowException(System.String, System.Exception, Int32, Int32, System.Uri, System.Windows.Markup.XamlObjectIds, System.Windows.Markup.XamlObjectIds, System.Type) Stack Trace : at System.Windows.Markup.XamlParseException.ThrowException(String message, Exception innerException, Int32 lineNumber, Int32 linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType) at System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext, Int32 lineNumber, Int32 linePosition, String message, Exception innerException) at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord) at System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord) at System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment() at System.Windows.Markup.TreeBuilder.Parse() at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream) at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator) at EMS.Controls.Dictionary.StatusBarControl.InitializeComponent() at EMS.Controls.Dictionary.StatusBarControl..ctor(IDataView content) at OCC600.ReportManager.ReportPresenter.ShowQueryView(Object arg, Boolean bringForward, Type selectedDataType) at OCC600.ReportManager.ReportPresenter..ctor(IUnityContainer container) at OCC600.ReportManager.Module.Initialize() at Microsoft.Practices.Composite.Modularity.ModuleLoader.Initialize(ModuleInfo[] moduleInfos) Inner Exception --------------- Type : System.InvalidCastException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Message : Unable to cast object of type 'System.Windows.Controls.Grid' to type 'EMS.Controls.Dictionary.StatusBarControl'. Source : EMS.Controls.Dictionary Help link : Data : System.Collections.ListDictionaryInternal TargetSite : Void System.Windows.Markup.IComponentConnector.Connect(Int32, System.Object) Stack Trace : at EMS.Controls.Dictionary.StatusBarControl.System.Windows.Markup.IComponentConnector.Connect(Int32 connectionId, Object target) at System.Windows.Markup.BamlRecordReader.ReadConnectionId(BamlConnectionIdRecord bamlConnectionIdRecord) at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord) The XAML page is given below: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cdic="clr-namespace:EMS.Controls.Dictionary.Primitives" xmlns:dicutil="clr-namespace:OCC600.Infrastructure.Dictionary.Utility;assembly=EMS.Infrastructure.Dictionary" Loaded="ResultSetControl_Loaded" <StatusBarItem Margin="10,0, 10, 0"> <TextBlock Text="{Binding CountText}" Padding="5,0"/> </StatusBarItem> <StatusBarItem Margin="10,0"> <TextBlock Text="{Binding MemoryUsageText}" Padding="5,0"/> </StatusBarItem> <StatusBarItem Margin="10,0" MaxWidth="400"> <TextBlock Text="{Binding StatusReport.Summary}" Padding="5,0" /> </StatusBarItem> <ProgressBar Margin="20,0" Name="progBar" Width="150" Height="13" Visibility="Collapsed" > <ProgressBar.ContextMenu> <ContextMenu Name="ctxMenu" ItemsSource="{Binding ActiveWorkItems}" Visibility="{Binding Path=ActiveWorkItems.HasItems, Converter={StaticResource BooToVisConv}}"> <ContextMenu.ItemContainerStyle> <Style TargetType="{x:Type MenuItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type MenuItem}"> <StackPanel Height="20" Margin="10,0" Orientation="Horizontal" HorizontalAlignment="Left"> <TextBlock Text="{Binding Path=Name, Mode=OneTime}" Foreground="Black" VerticalAlignment="Center" HorizontalAlignment="Left" /> <ToggleButton Style="{StaticResource vistaGoldenToggleButtonStyle}" Padding="5,0" Content="Cancel" IsChecked="{Binding Cancel}" Margin="10,0,0,0" > </ToggleButton> </StackPanel> </ControlTemplate> </Setter.Value> </Setter> </Style> </ContextMenu.ItemContainerStyle> </ContextMenu> </ProgressBar.ContextMenu> </ProgressBar> <StatusBarItem Margin="10,0" MaxWidth="400" HorizontalAlignment="Right"> <StackPanel Orientation="Horizontal"> <TextBlock Text="Last Update:" Padding="5,0" /> <TextBlock Text="{Binding TimeStamp}" Padding="5,0" /> </StackPanel> </StatusBarItem> <!-- TODO: Put checkmark if all is well, or error if connection failed--> <StatusBarItem Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=dc:Ribbon, ResourceId=StatusBarItemAlt}}" DockPanel.Dock="Right" Padding="6,0,32,0" > <cdic:SplitButton Margin="5,0" Padding="5,2" Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type cdic:SplitButtonResources}, ResourceId=vistaSplitButtonStyle}}" Mode="Split"> <cdic:SplitButton.ContextMenu> <ContextMenu > <MenuItem Header="Refresh Now" Command="{Binding ToggleConnectivityCmd}" CommandParameter="false"/> <MenuItem IsCheckable="True" IsChecked="{Binding ConnectState, Converter={StaticResource isFailedConverter}}" CommandParameter="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=IsChecked}" Header="Work Offline" Command="{Binding ToggleConnectivityCmd}"/> </ContextMenu> </cdic:SplitButton.ContextMenu> <cdic:SplitButton.Content> <StackPanel Orientation="Horizontal"> <Image x:Name="img" Source="{Binding ConnectState, Converter={StaticResource imageConverter}}" Width="16" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center"/> <TextBlock Text="{Binding ConnectState}" Padding="3,0,0,0"/> </StackPanel> </cdic:SplitButton.Content> </cdic:SplitButton> </StatusBarItem> </StatusBar> </Grid> The error just seems to have come out of no where. Any ideas? TIA.

    Read the article

  • C++ Windows Forms application unhandled exception error when textbox empty

    - by cmorris1441
    I'm building a temperature conversion application in Visual Studio for a C++ course. It's a Windows Forms application and the code that I've written is below. There's other code to of course, but I'm not sure you need it to help me. My problem is, when I run the application if I don't have anything entered into either the txtFahrenheit or txtCelsius2 textboxes I get the following error: "An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll" The application only works right now when a number is entered into both of the textboxes. I was told to try and use this: Double::TryParse() but I'm brand new to C++ and can't figure out how to use it, even after checking the MSDN library. Here's my code: private: System::Void btnFtoC_Click(System::Object^ sender, System::EventArgs^ e) { // Convert the input in the Fahrenheit textbox to a double datatype named fahrenheit for manipulation double fahrenheit = Convert::ToDouble(txtFahrenheit->Text); // Set the result string to F * (5/9) -32 double result = fahrenheit * .5556 - 32; // Set the Celsius text box to display the result string txtCelsius->Text = result.ToString(); } private: System::Void btnCtoF_Click(System::Object^ sender, System::EventArgs^ e) { // Convert the input in the Celsius textbox to a double datatype name celsius for manipulation double celsius = Convert::ToDouble(txtCelsius2->Text); // Set the result2 string to C * (9/5) + 32 double result2 = celsius * 1.8 + 32; // Set the Fahrenheit text box to display the result2 string txtFahrenheit2->Text = result2.ToString(); }

    Read the article

  • C++: Explicit DLL Loading: First-chance Exception on non "extern C" functions

    - by Shiftbit
    I am having trouble importing my C++ functions. If I declare them as C functions I can successfully import them. When explicit loading, if any of the functions are missing the extern as C decoration I get a the following exception: First-chance exception at 0x00000000 in cpp.exe: 0xC0000005: Access violation. DLL.h: extern "C" __declspec(dllimport) int addC(int a, int b); __declspec(dllimport) int addCpp(int a, int b); DLL.cpp: #include "DLL.h" int addC(int a, int b) { return a + b; } int addCpp(int a, int b) { return a + b; } main.cpp: #include "..DLL/DLL.h" #include <stdio.h> #include <windows.h> int main() { int a = 2; int b = 1; typedef int (*PFNaddC)(int,int); typedef int (*PFNaddCpp)(int,int); HMODULE hDLL = LoadLibrary(TEXT("../Debug/DLL.dll")); if (hDLL != NULL) { PFNaddC pfnAddC = (PFNaddC)GetProcAddress(hDLL, "addC"); PFNaddCpp pfnAddCpp = (PFNaddCpp)GetProcAddress(hDLL, "addCpp"); printf("a=%d, b=%d\n", a,b); printf("pfnAddC: %d\n", pfnAddC(a,b)); printf("pfnAddCpp: %d\n", pfnAddCpp(a,b)); //EXCEPTION ON THIS LINE } getchar(); return 0; } How can I import c++ functions for dynamic loading? I have found that the following code works with implicit loading by referencing the *.lib, but I would like to learn about dynamic loading. Thank you to all in advance.

    Read the article

  • SQLiteDataAdapter Fill exception C# ADO.NET

    - by Lirik
    I'm trying to use the OleDb CSV parser to load some data from a CSV file and insert it into a SQLite database, but I get an exception with the OleDbAdapter.Fill method and it's frustrating: An unhandled exception of type 'System.Data.ConstraintException' occurred in System.Data.dll Additional information: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. Here is the source code: public void InsertData(String csvFileName, String tableName) { String dir = Path.GetDirectoryName(csvFileName); String name = Path.GetFileName(csvFileName); using (OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dir + @";Extended Properties=""Text;HDR=No;FMT=Delimited""")) { conn.Open(); using (OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM " + name, conn)) { QuoteDataSet ds = new QuoteDataSet(); adapter.Fill(ds, tableName); // <-- Exception here InsertData(ds, tableName); // <-- Inserts the data into the my SQLite db } } } class Program { static void Main(string[] args) { SQLiteDatabase target = new SQLiteDatabase(); string csvFileName = "D:\\Innovations\\Finch\\dev\\DataFeed\\YahooTagsInfo.csv"; string tableName = "Tags"; target.InsertData(csvFileName, tableName); Console.ReadKey(); } } The "YahooTagsInfo.csv" file looks like this: tagId,tagName,description,colName,dataType,realTime 1,s,Symbol,symbol,VARCHAR,FALSE 2,c8,After Hours Change,afterhours,DOUBLE,TRUE 3,g3,Annualized Gain,annualizedGain,DOUBLE,FALSE 4,a,Ask,ask,DOUBLE,FALSE 5,a5,Ask Size,askSize,DOUBLE,FALSE 6,a2,Average Daily Volume,avgDailyVolume,DOUBLE,FALSE 7,b,Bid,bid,DOUBLE,FALSE 8,b6,Bid Size,bidSize,DOUBLE,FALSE 9,b4,Book Value,bookValue,DOUBLE,FALSE I've tried the following: Removing the first line in the CSV file so it doesn't confuse it for real data. Changing the TRUE/FALSE realTime flag to 1/0. I've tried 1 and 2 together (i.e. removed the first line and changed the flag). None of these things helped... One constraint is that the tagId is supposed to be unique. Here is what the table look like in design view: Can anybody help me figure out what is the problem here?

    Read the article

  • Catching a nested-in-template exception [C++]

    - by Karol
    Hello, I have a problem with writing a catch clause for an exception that is a class nested in a template. To be more specific, I have a following definition of the template and exception: /** Generic stack implementation. Accepts std::list, std::deque and std::vector as inner container. */ template < typename T, template < typename Element, typename = std::allocator<Element> > class Container = std::deque > class stack { public: class StackEmptyException { }; ... /** Returns value from the top of the stack. Throws StackEmptyException when the stack is empty. */ T top() const; ... } I have a following template method that I want exception to catch: template <typename Stack> void testTopThrowsStackEmptyExceptionOnEmptyStack() { Stack stack; std::cout << "Testing top throws StackEmptyException on empty stack..."; try { stack.top(); } catch (Stack::StackEmptyException) { // as expected. } std::cout << "success." << std::endl; } When I compile it (-Wall, -pedantic) I get the following error: In function ‘void testTopThrowsStackEmptyExceptionOnEmptyStack()’: error: expected type-specifier error: expected unqualified-id before ‘)’ token === Build finished: 2 errors, 0 warnings === Thanks in advance for any help! What is interesting, if the stack implementation was not a template, then the compiler would accept the code as it is.

    Read the article

  • Detecting a Dispose() from an exception inside using block

    - by Augusto Radtke
    I have the following code in my application: using (var database = new Database()) { var poll = // Some database query code. foreach (Question question in poll.Questions) { foreach (Answer answer in question.Answers) { database.Remove(answer); } // This is a sample line that simulate an error. throw new Exception("deu pau"); database.Remove(question); } database.Remove(poll); } This code triggers the Database class Dispose() method as usual, and this method automatically commits the transaction to the database, but this leaves my database in an inconsistent state as the answers are erased but the question and the poll are not. There is any way that I can detect in the Dispose() method that it being called because of an exception instead of regular end of the closing block, so I can automate the rollback? I don´t want to manually add a try ... catch block, my objective is to use the using block as a logical safe transaction manager, so it commits to the database if the execution was clean or rollbacks if any exception occured. Do you have some thoughts on that?

    Read the article

  • Can I automatically throw descriptive exceptions with parameter values and class feild information?

    - by Robert H.
    I honestly don't throw exceptions often. I catch them even less, ironically. I currently work in shop where we let them bubble up to avicode. For whatever reason, however, avicode isn't configured to capture some of the critical bits I need when these exceptions come bouncing back to my attention. Specifically, I'd like to see the parameter values and the class’s field data at the time of the exception. I’d guess with the large suite of .Net services that I could create a static method to crawl up the stack, gather these bits and store them in a string that I could stick in my exception message. I really don't are how long such a method would take to execute as performance is no longer a concern when I hit one of these scenarios. If it's possible, I'm sure someone has done it. If that's the case, I'm having a hard time finding it. I think any search containing "exception" brings back too many resutls. Anyway, can this be done? If so, some examples or links would be great. Thanks in advance for your time, Robert

    Read the article

  • java servlet:response.sendRedirect() not giving illegal state exception if called after commit of re

    - by sahil garg
    after commit of response as here redirect statement should give exception but it is not doing so if this redirect statemnet is in if block.but it does give exception in case it is out of if block.i have shown same statement(with marked stars ) at two places below.can u please tell me reason for it. protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub synchronized (noOfRequests) { noOfRequests++; } PrintWriter pw=null; response.setContentType("text/html"); response.setHeader("foo","bar"); //response is commited because of above statement pw=response.getWriter(); pw.print("hello : "+noOfRequests); //if i remove below statement this same statement is present in if block.so statement in if block should also give exception as this one do, but its not doing so.why? ***response.sendRedirect("http://localhost:8625/ServletPrc/login% 20page.html"); if(true) { //same statement as above ***response.sendRedirect("http://localhost:8625/ServletPrc/login%20page.html"); } else{ request.setAttribute("noOfReq", noOfRequests); request.setAttribute("name", new Name().getName()); request.setAttribute("GmailId",this.getServletConfig().getInitParameter("GmailId") ); request.setAttribute("YahooId",this.getServletConfig().getInitParameter("YahooId") ); RequestDispatcher view1=request.getRequestDispatcher("HomePage.jsp"); view1.forward(request, response); } }

    Read the article

  • Weird exception: Cannot cast String to Boolean when using getBoolean

    - by La bla bla
    I'm getting a very weird error. I have 2 activities. On both I'm getting the SharedPreferences using MODE_PRIVATE (if it matters) by sp = getPreferences(MODE_PRIVATE); on each activity's onCreate() I'm calling sp.getBoolean(IntroActivity.SHOW_INTRO, true) On the IntroActivity this works fine. But when I'm trying in the main activity, I'm getting this 10-12 04:55:23.208: E/AndroidRuntime(11668): FATAL EXCEPTION: main 10-12 04:55:23.208: E/AndroidRuntime(11668): java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean 10-12 04:55:23.208: E/AndroidRuntime(11668): at android.app.SharedPreferencesImpl.getBoolean(SharedPreferencesImpl.java:242) 10-12 04:55:23.208: E/AndroidRuntime(11668): at com.lablabla.parkme.ParkMeActivity$2.onClick(ParkMeActivity.java:194) 10-12 04:55:23.208: E/AndroidRuntime(11668): at android.view.View.performClick(View.java:4084) 10-12 04:55:23.208: E/AndroidRuntime(11668): at android.view.View$PerformClick.run(View.java:16966) 10-12 04:55:23.208: E/AndroidRuntime(11668): at android.os.Handler.handleCallback(Handler.java:615) 10-12 04:55:23.208: E/AndroidRuntime(11668): at android.os.Handler.dispatchMessage(Handler.java:92) 10-12 04:55:23.208: E/AndroidRuntime(11668): at android.os.Looper.loop(Looper.java:137) 10-12 04:55:23.208: E/AndroidRuntime(11668): at android.app.ActivityThread.main(ActivityThread.java:4745) 10-12 04:55:23.208: E/AndroidRuntime(11668): at java.lang.reflect.Method.invokeNative(Native Method) 10-12 04:55:23.208: E/AndroidRuntime(11668): at java.lang.reflect.Method.invoke(Method.java:511) 10-12 04:55:23.208: E/AndroidRuntime(11668): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 10-12 04:55:23.208: E/AndroidRuntime(11668): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 10-12 04:55:23.208: E/AndroidRuntime(11668): at dalvik.system.NativeStart.main(Native Method) I made sure that I'm not putting a String somewhere in the middle with that same key Any ideas? Thanks! EDIT: some code: //onCreate() sp = getPreferences(MODE_PRIVATE); // other method boolean showIntro = sp.getBoolean(IntroActivity.SHOW_INTRO, true); // Exception is here showIntroCheckBox.setChecked(showIntro); If it matters, the code which throws the exception is inside a button's onClick

    Read the article

  • ASP.NET Error Handling: Creating an extension method to send error email

    - by Jalpesh P. Vadgama
    Error handling in asp.net required to handle any kind of error occurred. We all are using that in one or another scenario. But some errors are there which will occur in some specific scenario in production environment in this case We can’t show our programming errors to the End user. So we are going to put a error page over there or whatever best suited as per our requirement. But as a programmer we should know that error so we can track the scenario and we can solve that error or can handle error. In this kind of situation an Error Email comes handy. Whenever any occurs in system it will going to send error in our email. Here I am going to write a extension method which will send errors in email. From asp.net 3.5 or higher version of .NET framework  its provides a unique way to extend your classes. Here you can fine more information about extension method. So lets create extension method via implementing a static class like following. I am going to use same code for sending email via my Gmail account from here. Following is code for that. using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Net.Mail; namespace Experiement { public static class MyExtension { public static void SendErrorEmail(this Exception ex) { MailMessage mailMessage = new MailMessage(new MailAddress("[email protected]") , new MailAddress("[email protected]")); mailMessage.Subject = "Exception Occured in your site"; mailMessage.IsBodyHtml = true; System.Text.StringBuilder errorMessage = new System.Text.StringBuilder(); errorMessage.AppendLine(string.Format("<B>{0}</B>:{1}<BR/>","Exception",ex.Message)); errorMessage.AppendLine(string.Format("<B>{0}</B>:{1}<BR/>", "Stack Trace", ex.StackTrace)); if (ex.InnerException != null) { errorMessage.AppendLine(string.Format("<B>{0}</B>:{1}<BR/>", " Inner Exception", ex.InnerException.Message)); errorMessage.AppendLine(string.Format("<B>{0}</B>:{1}<BR/>", "Inner Stack Trace", ex.InnerException.StackTrace)); } mailMessage.Body = errorMessage.ToString(); System.Net.NetworkCredential networkCredentials = new System.Net.NetworkCredential("[email protected]", "password"); SmtpClient smtpClient = new SmtpClient(); smtpClient.EnableSsl = true; smtpClient.UseDefaultCredentials = false; smtpClient.Credentials = networkCredentials; smtpClient.Host = "smtp.gmail.com"; smtpClient.Port = 587; smtpClient.Send(mailMessage); } } } After creating an extension method let us that extension method to handle error like following in page load event of page. using System; namespace Experiement { public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender,System.EventArgs e) { try { throw new Exception("My custom Exception"); } catch (Exception ex) { ex.SendErrorEmail(); Response.Write(ex.Message); } } } } Now in above code I have generated custom exception for example but in production It can be any Exception. And you can see I have use ex.SendErrorEmail() function in catch block to send email. That’s it.. Now it will throw exception and you will email in your email box like below.   That’s its. It’s so simple…Stay tuned for more.. Happy programming.. Technorati Tags: Exception,Extension Mehtod,Error Handling,ASP.NET

    Read the article

  • GWT Javascript Exception in Hosted Mode: Result of expression 'doc.getBoxObjectFor' [undefined] is

    - by holmes
    Anyone ever seen this exception? I'm running in hosted mode on GWT 1.6.4 on a mac. I'm using the AutoSuggest and it's throwing this exception trying to show the popup. It works fine in compiled mode, but obviously hosted mode is rather important. [ERROR] Uncaught exception escaped com.google.gwt.core.client.JavaScriptException: (TypeError): Result of expression 'doc.getBoxObjectFor' [undefined] is not a function. line: 71 sourceId: 1152617088 sourceURL: jar:file:/Users/holmes/.m2/repository/com/google/gwt/gwt-user/1.6.4/gwt-user-1.6.4.jar!/com/google/gwt/dom/client/DOMImplMozillaOld.java expressionBeginOffset: 288 expressionCaretOffset: 307 expressionEndOffset: 313 at com.google.gwt.dom.client.DOMImplMozillaOld.getAbsoluteLeftImpl(Native Method) at com.google.gwt.dom.client.DOMImplMozillaOld.getAbsoluteLeft(DOMImplMozillaOld.java:29) at com.google.gwt.dom.client.Element$.getAbsoluteLeft$(Element.java:86) at com.google.gwt.user.client.DOM.getAbsoluteLeft(DOM.java:646) at com.google.gwt.user.client.ui.UIObject.getAbsoluteLeft(UIObject.java:487) at com.google.gwt.user.client.ui.PopupPanel.position(PopupPanel.java:1015) at com.google.gwt.user.client.ui.PopupPanel.access$5(PopupPanel.java:958) at com.google.gwt.user.client.ui.PopupPanel$1.setPosition(PopupPanel.java:811) at com.google.gwt.user.client.ui.PopupPanel.setPopupPositionAndShow(PopupPanel.java:700) at com.google.gwt.user.client.ui.PopupPanel.showRelativeTo(PopupPanel.java:809) at com.google.gwt.user.client.ui.SuggestBox.showSuggestions(SuggestBox.java:768) at com.google.gwt.user.client.ui.SuggestBox.access$3(SuggestBox.java:738) at com.google.gwt.user.client.ui.SuggestBox$1.onSuggestionsReady(SuggestBox.java:281) at com.google.gwt.user.client.ui.MultiWordSuggestOracle.requestSuggestions(MultiWordSuggestOracle.java:225) at com.google.gwt.user.client.ui.SuggestBox.showSuggestions(SuggestBox.java:640) at com.google.gwt.user.client.ui.SuggestBox.refreshSuggestions(SuggestBox.java:713) at com.google.gwt.user.client.ui.SuggestBox.access$6(SuggestBox.java:705) at com.google.gwt.user.client.ui.SuggestBox$1TextBoxEvents.onKeyUp(SuggestBox.java:678) at com.google.gwt.event.dom.client.KeyUpEvent.dispatch(KeyUpEvent.java:54) at com.google.gwt.event.dom.client.KeyUpEvent.dispatch(KeyUpEvent.java:1) at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.fireEvent(HandlerManager.java:65) at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access$1(HandlerManager.java:53) at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:178) at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:52) at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116) at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:90) at com.google.gwt.user.client.ui.TextBoxBase.onBrowserEvent(TextBoxBase.java:193) at com.google.gwt.user.client.ui.Composite.onBrowserEvent(Composite.java:54) at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1320) at com.google.gwt.user.client.DOM.dispatchEventAndCatch(DOM.java:1299) at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1262)

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >