1 package org.sonatype.aether;
2
3 /*******************************************************************************
4 * Copyright (c) 2010-2011 Sonatype, Inc.
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v1.0
7 * which accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v10.html
9 *******************************************************************************/
10
11 /**
12 * The base class for exceptions thrown by the repository system.
13 *
14 * @author Benjamin Bentmann
15 */
16 public class RepositoryException
17 extends Exception
18 {
19
20 public RepositoryException( String message )
21 {
22 super( message );
23 }
24
25 public RepositoryException( String message, Throwable cause )
26 {
27 super( message, cause );
28 }
29
30 public static String getMessage( String prefix, Throwable cause )
31 {
32 String msg = "";
33 if ( cause != null )
34 {
35 msg = cause.getMessage();
36 if ( msg == null || msg.length() <= 0 )
37 {
38 msg = cause.getClass().getSimpleName();
39 }
40 msg = prefix + msg;
41 }
42 return msg;
43 }
44
45 }