Ignore:
Timestamp:
Feb 7, 2008, 3:50:38 PM (14 years ago)
Author:
Peter
Message:

replaced some cerr outputs with exception throws - refs #189

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/regression/Local.cc

    r1015 r1049  
    3232#include <cassert>
    3333#include <iostream>
     34#include <sstream>
     35#include <stdexcept>
    3436
    3537namespace theplu {
     
    5355  void Local::fit(const size_t step_size, const size_t nof_points)
    5456  {
    55     if (step_size==0 || nof_points<3){
    56       std::cerr << "yat::regression::Local "
    57                 << "Parameters invalid. Fitting ignored." << std::endl;
    58       return;
     57    if (step_size==0){
     58      std::stringstream ss;
     59      ss << "yat::regression::local: step_size must be larger than zero.";
     60      throw std::runtime_error(ss.str());
     61    }
     62    if (nof_points<3){
     63      std::stringstream ss;
     64      ss << "yat::regression::local: too few data points. "
     65         << "At least 3 data points are needed to perform fitting.";
     66      throw std::runtime_error(ss.str());
    5967    }
    6068
Note: See TracChangeset for help on using the changeset viewer.