using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
namespace FoolballLeague
{
public partial class MainMenu : Form
{
...
This code works;
int at(int index) {
if(index < 1 || index >= size)
throw 0;
return x[index];
}
Yet this doesn't
int at(int index) {
if(index < 1 || index >= size)
throw std::out_of_range;
return x[index];
}
I get the error "expected primary expression before ';'". Now... it surprises me because I know std::out_o...
EDIT: SORRY!
Turns out that I'm an idiot. The exception was being thrown from another call to r.nextInt() which was taking an uninitialized variable as an argument! Foot is very much in mouth.
I'm really not sure what else to say about this:
Random r = new Random();
class SomeClass {
public SomeClass(){
new SomeClass(r.next...
Suppose that I have the following code:
private void UpdateDB(QuoteDataSet dataSet, Strint tableName)
{
using(SQLiteConnection conn = new SQLiteConnection(_connectionString))
{
conn.Open();
using (SQLiteTransaction transaction = conn.BeginTransaction())
{
using (SQLiteCommand cmd = new SQLit...
We have a REST API that works great. We're refactoring and deciding how to internally handle errors by the users of our API.
For example the user needs to specify the "movie" url parameter which should take the value of "1984", "Crash", or "Avatar". First we check to see if it has a valid value.
What would be the best approach if the...
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 ...
I'm trying to use code similar to clrdump to create mini dumps in my managed process.
This managed process invokes C++/CLI code which invokes some native C++ static lib code, wherein SEH exceptions may be thrown (e.g. the occasional access violation).
C# WinForms
->
C++/CLI DLL
->
Static C++ Lib
->
ACC...
I've recently started a new project in C#, and, as I was coding some exception throw in a function, I figured out I didn't really know which exception I should use.
Here are common exceptions that are often thrown in many programs :
ArgumentException
ArgumentNullException
InvalidOperationException
DivideByZeroException
FileNotFoundEx...
While replacing or inserting into an NSMutable array, I am getting exception as:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '* -[NSCFArray replaceObjectAtIndex:withObject:]: mutating method sent to immutable object'
[list replaceObjectAtIndex:indexRow withObject:editcontacts];
//or
[list ...
Possible Duplicate:
How slow are .NET exceptions?
I've been reading all over the place (including here) about when exception should / shouldn't be used.
I now want to change my code that would throw to make the method return false and handle it like that, but my question is: Is it the throwing or try..catch-ing that can hinder...
Hello everyone.
I try to implement an RSA algorithm in a Java program. I am facing the "BadPaddingException : data must start with zero".
Here are the methods used to encrypt and decrypt my data :
public byte[] encrypt(byte[] input) throws Exception
{
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");//
cipher.init(Ci...
catch is not working because there is installed an exception handler using set_exception_handler()
I need "catch" to work, so I guess I need to unset the exception handler somehow. Things such as set_exception_handler(NULL) isn't working.
Any ideas how to unset the exception handler?
function my_exception_handler($exception) {
er...
I'm having problems creating a collection of delegate using reflection and generics.
I'm trying to create a delegate collection from Ally methods, whose share a common method signature.
public class Classy
{
public string FirstMethod<T1, T2>( string id, Func<T1, int, IEnumerable<T2>> del );
public string SecondMethod<T1, T2>( strin...
hello.
I am using gcc on linux to compile C++ code.
There are some exceptions which should not be handled and should close program.
However, I would like to be able to display exception string:
For example:
throw std::runtime_error(" message"); does not display message, only type of error.
I would like to display messages as well.
Is ...
Hello, guys!
I have some User model, Role model and Assignment model to manage role-based user system.
Just like here .
So, here some kind of code, to include roles into users form:
<% for role in Role.all %>
<%= check_box_tag "user[role_ids][]", role.id, @user.roles.include?(role) %>
<%=h role.name %><br />
<% end %>
And all's work...
I'm looking for such a tool to be able to check fast if I catch all the exceptions I generate myself.
Thanks!
...
My colleague wrote the following stackoverflow question:
other stack overflow question on this topic
The question seems to have been misinterpreted and I want to find out the answer, so I'm starting this new question... hopefully a little more clear.
Basically, we have a REST API. Users of our API call our methods with parameters. Bu...
I'm baffled. What could be causing 'catch' not to be working and how do I fix it?
<?php
try {
throw new Exception('BOOM');
error_log("should not happen");
} catch(Exception $e) {
error_log("should happen: " . $e->getMessage());
}
?>
Actual output
[27-Apr-2010 09:43:24] PHP Fatal error: Uncaught exception 'Exception' wi...
I get the following exception:
org.jboss.cache.CacheException:
java.lang.RuntimeException: Failure to
marshal argument(s)
We use distributed JBoss cache for our web application (on Tomcat)
I have a strong feeling this is due to bad configuration, but not sure.
Edit (Correction):
We use version 3.0.0.GA of Jboss cache (core)
...
Hi
What is the common or best practice to structure the location of your exception classes?
Let's say you have the packages/namespaces myproject.person (models and DAOs for persons) and myproject.order (models and DAOs for orders) and the exceptions PersonException and OrderException. Should I put the exceptions in their corresponding ...