com.devcraftsman.blog.post.impl.PostNotFoundException.java Source code

Java tutorial

Introduction

Here is the source code for com.devcraftsman.blog.post.impl.PostNotFoundException.java

Source

package com.devcraftsman.blog.post.impl;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

/**
 * Created by devcraftsman on 3/29/16.
 * ----------------------------------------------------
 * This software is licensed under the Apache 2 license
 * see: [http://www.apache.org/licenses/LICENSE-2.0]
 **/

@JsonSerialize
public class PostNotFoundException extends RuntimeException {

    private final String id;

    @JsonCreator
    public PostNotFoundException(String postId) {
        super("unable to found post with id " + postId);
        this.id = postId;
    }

    public PostNotFoundException(String postId, Throwable t) {
        super("unable to found post with id " + postId, t);
        this.id = postId;
        this.initCause(t);
    }

}