Make the main exception data
8226
protected function makeMainException()
	{
		$this->mainExceptionData['uses'] = [
			'RuntimeException'
		];
		$this->mainExceptionData['className'] = 'ApiException';
		$this->mainExceptionData['classPhpDocTitle'] = 'Api Exception class';
		$this->mainExceptionData['namespace'] = $this->namespace . '\\Exceptions';
		$this->mainExceptionData['extends'] = 'RuntimeException';
	}
206578
def main(self, args=None):
        """"""

        if get_compat_0_1():
            args = self.main_0_1_preamble()

        d = {'multithreaded': self.multithreaded and 1 or 0}
        d['fuse_args'] = args or self.fuse_args.assemble()

        for t in 'file_class', 'dir_class':
            if hasattr(self, t):
                getattr(self.methproxy, 'set_' + t)(getattr(self,t))

        for a in self._attrs:
            b = a
            if get_compat_0_1() and a in self.compatmap:
                b = self.compatmap[a]
            if hasattr(self, b):
                c = ''
                if get_compat_0_1() and hasattr(self, a + '_compat_0_1'):
                    c = '_compat_0_1'
                d[a] = ErrnoWrapper(self.lowwrap(a + c))

        try:
            main(**d)
        except FuseError:
            if args or self.fuse_args.mount_expected():
                raise
1023622
private List<Row> createExceptionAssignmentRowList(String exceptionData)
   {
      List<Row> list = new ArrayList<Row>();
      String[] exceptions = exceptionData.split(",|:");
      int index = 1;
      while (index < exceptions.length)
      {
         Date startDate = DatatypeConverter.parseEpochTimestamp(exceptions[index + 0]);
         Date endDate = DatatypeConverter.parseEpochTimestamp(exceptions[index + 1]);
         //Integer exceptionTypeID = Integer.valueOf(exceptions[index + 2]);

         Map<String, Object> map = new HashMap<String, Object>();
         map.put("STARU_DATE", startDate);
         map.put("ENE_DATE", endDate);

         list.add(new MapRow(map));

         index += 3;
      }

      return list;
   }
437400
public static void main(String[] args) throws Exception {
		Configuration globalConfig = GlobalConfiguration.loadConfiguration();
		PythonPlanBinder binder = new PythonPlanBinder(globalConfig);
		try {
			binder.runPlan(args);
		} catch (Exception e) {
			System.out.println("Failed to run plan: " + e.getMessage());
			LOG.error("Failed to run plan.", e);
		}
	}
1320014
public static void main(String[] args) throws Exception {
		
		if(!parseParameters(args)) {
			return;
		}
		
		final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

		// get customer data set: (custkey, name, address, nationkey, acctbal) 
		DataSet<Tuple5<Integer, String, String, Integer, Double>> customers = getCustomerDataSet(env);

		// get orders data set: (orderkey, custkey, orderdate)
		DataSet<Tuple3<Integer, Integer, String>> orders = getOrdersDataSet(env);

		// get lineitem data set: (orderkey, extendedprice, discount, returnflag)
		DataSet<Tuple4<Integer, Double, Double, String>> lineitems = getLineitemDataSet(env);

		// get nation data set: (nationkey, name)
		DataSet<Tuple2<Integer, String>> nations = getNationsDataSet(env);

		// orders filtered by year: (orderkey, custkey)
		DataSet<Tuple2<Integer, Integer>> ordersFilteredByYear =
				// filter by year
				orders.filter(
								new FilterFunction<Tuple3<Integer,Integer, String>>() {
									@Override
									public boolean filter(Tuple3<Integer, Integer, String> t) {
										int year = Integer.parseInt(t.f2.substring(0, 4));
										return year > 1990;
									}
								})
				// project fields out that are no longer required
				.project(0,1).types(Integer.class, Integer.class);

		// lineitems filtered by flag: (orderkey, extendedprice, discount)
		DataSet<Tuple3<Integer, Double, Double>> lineitemsFilteredByFlag = 
				// filter by flag
				lineitems.filter(new FilterFunction<Tuple4<Integer, Double, Double, String>>() {
										@Override
										public boolean filter(Tuple4<Integer, Double, Double, String> t)
												throws Exception {
											return t.f3.equals("R");
										}
								})
				// project fields out that are no longer required
				.project(0,1,2).types(Integer.class, Double.class, Double.class);

		// join orders with lineitems: (custkey, extendedprice, discount)
		DataSet<Tuple3<Integer, Double, Double>> lineitemsOfCustomerKey = 
				ordersFilteredByYear.joinWithHuge(lineitemsFilteredByFlag)
									.where(0).equalTo(0)
									.projectFirst(1).projectSecond(1,2)
									.types(Integer.class, Double.class, Double.class);

		// aggregate for revenue: (custkey, revenue)
		DataSet<Tuple2<Integer, Double>> revenueOfCustomerKey = lineitemsOfCustomerKey
				// calculate the revenue for each item
				.map(new MapFunction<Tuple3<Integer, Double, Double>, Tuple2<Integer, Double>>() {
							@Override
							public Tuple2<Integer, Double> map(Tuple3<Integer, Double, Double> t) {
								// revenue per item = l_extendedprice * (1 - l_discount)
								return new Tuple2<Integer, Double>(t.f0, t.f1 * (1 - t.f2));
							}
					})
				// aggregate the revenues per item to revenue per customer
				.groupBy(0).aggregate(Aggregations.SUM, 1);

		// join customer with nation (custkey, name, address, nationname, acctbal)
		DataSet<Tuple5<Integer, String, String, String, Double>> customerWithNation = customers
						.joinWithTiny(nations)
						.where(3).equalTo(0)
						.projectFirst(0,1,2).projectSecond(1).projectFirst(4)
						.types(Integer.class, String.class, String.class, String.class, Double.class);

		// join customer (with nation) with revenue (custkey, name, address, nationname, acctbal, revenue)
		DataSet<Tuple6<Integer, String, String, String, Double, Double>> customerWithRevenue = 
				customerWithNation.join(revenueOfCustomerKey)
				.where(0).equalTo(0)
				.projectFirst(0,1,2,3,4).projectSecond(1)
				.types(Integer.class, String.class, String.class, String.class, Double.class, Double.class);

		// emit result
		customerWithRevenue.writeAsCsv(outputPath);
		
		// execute program
		env.execute("TPCH Query 10 Example");
		
	}
886949
public static void main(Class main, String[] args) throws Exception {
    String[] packageNamesToWeave = { main.getPackage().getName()} ;
    main(main, args, packageNamesToWeave);
  }
239681
public static void main(String[] args) throws Throwable {

        final Exception exceptionToThrowLater = new Exception("Raygun4Java test exception");

        // sets the global unhandled exception handler
        Thread.setDefaultUncaughtExceptionHandler(MyExceptionHandler.instance());

        MyExceptionHandler.getClient().recordBreadcrumb("App starting up");

        RaygunIdentifier userIdentity = new RaygunIdentifier("a@b.com")
                .withEmail("a@b.com")
                .withFirstName("Foo")
                .withFullName("Foo Bar")
                .withAnonymous(false)
                .withUuid(UUID.randomUUID().toString());
        MyExceptionHandler.getClient().setUser(userIdentity);

        new Thread(new Runnable() {
            @Override
            public void run() {
                MyExceptionHandler.getClient().recordBreadcrumb("different thread starting");

                // note that use info not set on this thread

                try {
                    MyExceptionHandler.getClient().recordBreadcrumb("throwing exception");
                    throw exceptionToThrowLater;
                } catch (Exception e) {
                    MyExceptionHandler.getClient().recordBreadcrumb("handling exception");

                    Map<String, String> customData = new HashMap<String, String>();
                    customData.put("thread id", "" + Thread.currentThread().getId());
                    MyExceptionHandler.getClient()
                            .withTag("thrown from thread")
                            .withTag("no user withData")
                            .withData("thread id", "" + Thread.currentThread().getId())
                            .send(exceptionToThrowLater);

                    // this should appear in the raygun console as its already been sed
                    MyExceptionHandler.getClient().recordBreadcrumb("This should not appear because we're sending the same exception on the same thread");
                    Set<String> tags = new HashSet<String>();
                    tags.add("should not appear in console");
                    MyExceptionHandler.getClient().send(exceptionToThrowLater, tags);
                }

                // test offline storage by breaking the proxy
                RaygunSettings.getSettings().setHttpProxy("nothing here", 80);

                System.out.println("No Send below this line");
                MyExceptionHandler.getClient().send(new Exception("occurred while offline offline"));
                System.out.println("No Send above this lines ^");

                // fix the proxy and send offline data
                RaygunSettings.getSettings().setHttpProxy(null, 80);
                MyExceptionHandler.getClient().send(new Exception("This should trigger offline"));

            }
        }).start();

        MyExceptionHandler.getClient().recordBreadcrumb("Throwing exception on main thread");
        throw exceptionToThrowLater;
    }
1007263
def set_exception(self, exception):
        """"""
        self._exception = exception
        self._result_set = True
        self._invoke_callbacks(self)
1154192
def _attach_original_exception(self, exc):
        

        original_exception = sys.exc_info()
        if original_exception[0] is not None:
            exc.original_exception = original_exception
894686
def exception(self, exception):
        """"""
        if self.writelog:
            self.logger.exception(exception)
        if self.verbose:
            for line in  traceback.format_exception(
                    None, exception, exception.__traceback__):
                print(line, end='', file=sys.stderr, flush=True)
5933
public static void main(String[] args) throws Exception {
    ArgP argp = new ArgP();
    CliOptions.addCommon(argp);
    argp.addOption("--use-data-table",
        "Scan against the raw data table instead of the meta data table.");
    args = CliOptions.parse(argp, args);
    if (args == null) {
      usage(argp, "Invalid usage");
      System.exit(2);
    } else if (args.length < 1) {
      usage(argp, "Not enough arguments");
      System.exit(2);
    }
    
    final boolean use_data_table = argp.has("--use-data-table");
    
    Config config = CliOptions.getConfig(argp);
    final TSDB tsdb = new TSDB(config);
    tsdb.checkNecessaryTablesExist().joinUninterruptibly();
    
    int rc;
    try {
      rc = runCommand(tsdb, use_data_table, args);
    } finally {
      try {
        tsdb.getClient().shutdown().joinUninterruptibly();
        LOG.info("Gracefully shutdown the TSD");
      } catch (Exception e) {
        LOG.error("Unexpected exception while shutting down", e);
        rc = 42;
      }
    }
    System.exit(rc);
  }
565337
public static void main(String[] args) throws Exception {

    NormalAlphabet na = new NormalAlphabet();
    SAXProcessor sp = new SAXProcessor();

    String dataFileName = args[0];

    System.out.println("data file: " + dataFileName);
    double[] ts = TSProcessor.readFileColumn(dataFileName, 0, 0);
    System.out.println("data size: " + ts.length);
    System.out.println("SAX parameters:\n sliding window sizes: " + Arrays.toString(WINDOWS)
        + "\n PAA sizes: " + Arrays.toString(PAAS) + "\n alphabet sizes: "
        + Arrays.toString(ALPHABETS) + "\n NR strategis: " + Arrays.toString(NRS));

    System.out.println(
        "Performing " + NRUNS + " SAX conversion runs for each algorithm implementation ... ");

    // conventional
    //
    long tstamp1 = System.currentTimeMillis();
    for (int slidingWindowSize : WINDOWS) {
      for (int paaSize : PAAS) {
        for (int alphabetSize : ALPHABETS) {
          for (String nrStrategy : NRS) {

            for (int i = 0; i < NRUNS; i++) {
              @SuppressWarnings("unused")
              SAXRecords sequentialRes = sp.ts2saxViaWindow(ts, slidingWindowSize, paaSize,
                  na.getCuts(alphabetSize), NumerosityReductionStrategy.fromString(nrStrategy),
                  N_THRESHOLD);
            }

          }
        }
      }
    }
    long tstamp2 = System.currentTimeMillis();
    System.out.println("single thread conversion: " + String.valueOf(tstamp2 - tstamp1) + ", "
        + SAXProcessor.timeToString(tstamp1, tstamp2));

    // parallel
    for (int threadsNum = MIN_CPUS; threadsNum < MAX_CPUS; threadsNum++) {
      tstamp1 = System.currentTimeMillis();

      for (int slidingWindowSize : WINDOWS) {
        for (int paaSize : PAAS) {
          for (int alphabetSize : ALPHABETS) {
            for (String nrStrategy : NRS) {

              for (int i = 0; i < NRUNS; i++) {
                ParallelSAXImplementation ps = new ParallelSAXImplementation();
                @SuppressWarnings("unused")
                SAXRecords parallelRes = ps.process(ts, threadsNum, slidingWindowSize, paaSize,
                    alphabetSize, NumerosityReductionStrategy.fromString(nrStrategy), N_THRESHOLD);
              }

            }
          }
        }
      }

      tstamp2 = System.currentTimeMillis();
      System.out.println("parallel conversion using " + threadsNum + " threads: "
          + String.valueOf(tstamp2 - tstamp1) + ", " + SAXProcessor.timeToString(tstamp1, tstamp2));
    }
  }
815415
def _format_exception(err, is_failure, stdout=None, stderr=None):
    """"""
    exctype, value, tb = err
    # Skip test runner traceback levels
    while tb and _is_relevant_tb_level(tb):
        tb = tb.tb_next

    if is_failure:
        # Skip assert*() traceback levels
        length = _count_relevant_tb_levels(tb)
        msgLines = traceback.format_exception(exctype, value, tb, length)
    else:
        msgLines = traceback.format_exception(exctype, value, tb)

    encoding = locale.getpreferredencoding()
    msgLines = [_decode(line, encoding) for line in msgLines]

    if stdout:
        if not stdout.endswith('\n'):
            stdout += '\n'
        msgLines.append(STDOUT_LINE % stdout)
    if stderr:
        if not stderr.endswith('\n'):
            stderr += '\n'
        msgLines.append(STDERR_LINE % stderr)
    return ''.join(msgLines)
640872
def _handle_exception():
    """"""
    # Heavily influenced by logging.Handler.handleError.

    # See note here:
    # https://docs.python.org/3.4/library/sys.html#sys.__stderr__
    if sys.stderr:
        einfo = sys.exc_info()
        try:
            traceback.print_exception(einfo[0], einfo[1], einfo[2],
                                      None, sys.stderr)
        except IOError:
            pass
        finally:
            del einfo
1259220
def set_exception(self, exception):
        """"""
        self.set_exc_info(
            (exception.__class__,
             exception,
             getattr(exception, '__traceback__', None)))
894095
def add_error(name=None, code=None, status=None):
    """"""
    if not name or not status or not code:
        raise Exception("Can't create Exception class %s: you must set both name, status and code" % name)
    myexception = type(name, (PyMacaronException, ), {"code": code, "status": status})
    globals()[name] = myexception
    if code in code_to_class:
        raise Exception("ERROR! Exception %s is already defined." % code)
    code_to_class[code] = myexception
    return myexception
816866
def setup_exceptions():
    
    # first set up the variables needed by the _excepthook function
    global _print_traceback, _drill
    local_print_traceback = os.getenv("PYLOGCONF_PRINT_TRACEBACK")
    if local_print_traceback is not None:
        _print_traceback = _str2bool(local_print_traceback)
    local_drill = os.getenv("PYLOGCONF_DRILL")
    if local_drill is not None:
        _drill = _str2bool(local_drill)
    # now that everything is ready attach the hook
    sys.excepthook = _excepthook