public void addJoke( string userName, string password, string joke) { jokesImplement jokesObj = new jokesImplement(); try { jokesObj.addJoke(userName, password, joke); // catch jokeExceptions } catch (jokeException e) { throwFault("Fault occurred", e.failReason, userName); } // then, catch general System Exceptions catch (Exception e) { throwFault(e.Message, "F_System", userName); } }
public xmlJokesReturn[] getUnmoderated( string userName, string password, int howMany) { jokesImplement jokesObj = new jokesImplement(); try { xmlJokesReturn[] myJokes = jokesObj.getUnmoderated(userName, password, howMany); return(myJokes); // catch jokeExceptions } catch (jokeException e) { throwFault("Fault occurred", e.failReason, userName); return(null); // code never reached, but needed by compiler } // then, catch general System Exceptions catch (Exception e) { throwFault(e.Message, "F_System", userName); return(null); // code never reached, but needed by compiler } }
public void addRating( string userName, string password, int rating, int jokeID) { jokesImplement jokesObj = new jokesImplement(); try { if ((rating < 1) && (rating > 5)) { throwFault("Fault occurred", "F_ratingInvalid", userName); } else { jokesObj.addRating(userName, password, rating, jokeID); } // catch jokeExceptions } catch (jokeException e) { throwFault("Fault occurred", e.failReason, userName); } // then, catch general System Exceptions catch (Exception e) { throwFault(e.Message, "F_System", userName); } }