try { } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Exception: " + ex.Message); } try { } catch (Exception ) { } Throw an error if (hex.Length != 6) throw new Exception("Color not valid");