#------------------------------------------------------------
# Copyright (C) 2009 RoyaltyShare, Inc.   All Rights Reserved
#------------------------------------------------------------
use strict;
use warnings;

use lib '/app/tools/common/lib';
use Common::Assert;

package BookPub::Catalog::Import::Process::Error;

sub new {
    my ( $class, $details ) = @_;

    my $self = bless {}, $class;
    return $self->_init($details);
}

sub _init {
    my ( $self, $details ) = @_;
    $self->{details} = $details;

    # $. is a magical perl variable that corresponds to
    # the line number of the 'current' open file handle.
    #
    $self->{lineNum} = $. if ($.);

    return $self;
}

sub details {
    my ($self) = @_;
    return $self->{details};
}

# This method returns a 'formatted' error message.
#
sub errorMessage {
    my ($self) = @_;

    my $details = $self->{details};

    my $msg = 'Error';

    $msg .= " at line " . $self->{lineNum} if $self->{lineNum};

    $msg .= ": $details";

    return $msg;
}

# !!! We could subclass this, if we wish.
#

1;
