title: How pass params to custom error message in JHipster?
body: <p>I m still learning JHipster, So today I though about making somme validation exerices by my self, and to try to send meaningfull error messages to my frontend</p>
  
  <p>Here is what I tried</p>
  
  <p>In my controller I have the following :</p>
  
  <pre><code>/**
   * POST  /lessons : Create a new lesson of 45 min.
   * 
   * if lesson is of type creno or circulation the car is mandatory
   *
   * @param lessonDTO the lessonDTO to create
   * @return the ResponseEntity with status 201 (Created) and with body the new lessonDTO, or with status 400 (Bad Request) if the lesson has already an ID
   * @throws URISyntaxException if the Location URI syntax is incorrect
   */
  @PostMapping("/lessons")
  public ResponseEntity&lt;LessonDTO&gt; createLesson(@Valid @RequestBody LessonDTO lessonDTO) throws URISyntaxException {
      log.debug("REST request to save Lesson : {}", lessonDTO);
      if (lessonDTO.getId() != null) {
          throw new BadRequestAlertException("A new lesson cannot already have an ID", ENTITY_NAME, "idexists");
      }
      if(!lessonService.checkLessonTime(lessonDTO)){
          return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(ENTITY_NAME,"EK_L_C01", "erreur de requete dupliquer")).build();
      }
      LessonDTO result = lessonService.save(lessonDTO);
      return ResponseEntity.created(new URI("/api/lessons/" + result.getId()))
          .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
          .body(result);
  }
  </code></pre>
  
  <p>as you see if the check lesson time fails I have to send a bad request response with failure code <strong>EK_L_C01</strong> then my next step ws to make a little change in the front end where I got to make this</p>
  
  <pre><code>save() {
      this.isSaving = true;
      this.lesson.dateLesson = this.dateLesson != null ? moment(this.dateLesson, DATE_TIME_FORMAT) : null;
      if (this.lesson.id !== undefined) {
          this.subscribeToSaveResponse(this.lessonService.update(this.lesson));
      } else {
          this.subscribeToSaveResponse(this.lessonService.create(this.lesson));
      }
  }
  
  protected subscribeToSaveResponse(result: Observable&lt;HttpResponse&lt;ILesson&gt;&gt;) {
      result.subscribe((res: HttpResponse&lt;ILesson&gt;) =&gt; this.onSaveSuccess(), (res: HttpErrorResponse) =&gt; this.onSaveError(res.message));
  }
  
  protected onSaveSuccess() {
      this.isSaving = false;
      this.previousState();
  }
  
  protected onSaveError(errorMessage: string) {
      this.isSaving = false;
      this.onError(errorMessage);
  }
  
  protected onError(errorMessage: string) {
      this.jhiAlertService.error(errorMessage, null, null);
  }
  </code></pre>
  
  <p>then I added the translation of the code in my <strong>global.json</strong> as below</p>
  
  <pre><code>"error": {
          "internalServerError": "Erreur interne du serveur",
          "server.not.reachable": "Serveur inaccessible",
          "url.not.found": "Non trouvé",
          "NotNull": "Le champ {{fieldName}} ne peut pas être vide !",
          "Size": "Le champ {{fieldName}} ne respecte pas les critères minimum et maximum !",
          "userexists": "Login déjà utilisé !",
          "emailexists": "Email déjà utilisé !",
          "idexists": "Une nouvelle entité {{entityName}} ne peut pas avoir d'ID !",
          "idnull": "Invalid ID",
          "EK_L_C01": "Impossible de reserver une lesson : nombre maximal de lesson attein {{dateLesson}} "
      },
  </code></pre>
  
  <p>I have my message displayed but there is no date value.</p>
  
  <p>As you see I want to mention the date used as error message variable but I dont know how, so How can I add this date value to my error message ?</p>